Hi,
I have a form that has SQL in its VBA module to return records, depending on what values user has selected on the form.
I use COUNT in the SQL so I can have a column of how many records exist with certain values.
Now I would like to add a grand total to be displayed on the bottom of the form of all these counts (or, it would be the same to just count how many rows are returned). I believe it may be too complicated to do this with the same SQL, so I was wondering if there's a way to do it programmatically within my form's VBA. As a former mainframe programmer, I know I need a loop to keep a running total of all the rows returned from my SQL statement. However, this part always baffles me within Access/VBA. Where do I have or create such a loop for each record returned? I just want to keep a running total as the SQL is performed. Does that make sense? I have programmed subforms that have a detail section, and may have been successful there, but not sure this time around.
I also posted this question within the Query forum.
Thanks,
Lori
I have a form that has SQL in its VBA module to return records, depending on what values user has selected on the form.
I use COUNT in the SQL so I can have a column of how many records exist with certain values.
Now I would like to add a grand total to be displayed on the bottom of the form of all these counts (or, it would be the same to just count how many rows are returned). I believe it may be too complicated to do this with the same SQL, so I was wondering if there's a way to do it programmatically within my form's VBA. As a former mainframe programmer, I know I need a loop to keep a running total of all the rows returned from my SQL statement. However, this part always baffles me within Access/VBA. Where do I have or create such a loop for each record returned? I just want to keep a running total as the SQL is performed. Does that make sense? I have programmed subforms that have a detail section, and may have been successful there, but not sure this time around.
I also posted this question within the Query forum.
Thanks,
Lori