
Count values from field in ADO Recordset
You can do it with a SQL query like this:
SELECT SUM(Hours) AS TotalHours,
SUM(Minutes) AS TotalMinutes
FROM table-name
WHERE Project = project name/key
Don't forget to convert the TotalMinutes to hours/minutes and add the
right number of hours to TotalHours!
Quote:
> Hello,
> I have an ADO Recordset pointing to a database with time registration
> information. I want to add a function where the user selects a project and
> the application returns the total number of hours registered on that
> project. Simplified example of my table:
> Project
> Hours
> Minutes
> First I set a filter like this: AdoDc1.Recordset.Filter = "Project ='" &
> UserChoice & "'"
> Now I want to count the values of the hours and minutes records to give the
> user a total. I know I can loop through the recordset and add the values of
> the bound textboxes, but I think this is not the most efficient way to go.
> Any suggestions would be appreciated.
> Thanks in advance,
> Mark
> (vb6sp5)