jafortun@oakland.edu (James Fortune) wrote in message news:<a6ed3ce7.0408040108.434c7b94@posting.google. com>...[color=blue]
>
meganrobertson22@hotmail.com (Megan) wrote in message news:<5c14c12b.0408031417.78976437@posting.google. com>...[color=green]
> > hi everybody-
> >
> > i'm having a counting problem i hope you guys and gals could give me
> > some help with. i have a query that retrieves a bevy of information
> > from several different tables.
> >[/color]
>
> Megan,
>
> You did a great job explaining what your problem is. I checked
> reports I created in the past that grouped on multiple fields and I'm
> not happy with what I did in those cases. When I couldn't use SUM or
> COUNT directly I created Public functions in a module that would
> ensure I got the total or count that I wanted. For example:
>
> Control Source for the txtNumberOfCompanies textbox in the Footer:
>
> =CountSQLRecords("SELECT CompanyName FROM ... GROUP BY CompanyName;")
>
> Note that the SQL string used to get the count is somewhat similar to
> the one used for the RecordSource except you are now free to group the
> same way the report groups in order to get your count. You can also
> test out your SQL strings first by saving your report's RecordSource
> as a query and making sure the groupings give you what you want. I
> look forward to seeing if others have solved this problem so that I
> can simplify my reports. P.S., using 'Name' as the name of a field
> could possibly confuse Access.
>
> James A. Fortune[/color]
Thanks for the help James!!!
I haven't tried your idea yet, but I came up with another idea. I put
a text box with "Name = RecordCount" (without the quotes) in the
"Companies" Group Heading with the Control Source = 1. Then, I put
another text box in the "Companies" Group Footer, with the Control
Source = [RecordCount] and it gave me the total I needed.
I didn't know you could use SQL with a text box's control source.
Cool! There's a lot of things I'd like to try now!
P.S. Thanks for the compliment about doing a good job explaining what
I'm trying to do! I always try to be as clear and detailed as possible
while still trying to be as concise as possible. I read a lot of your
posts even if they don't apply to me in order to learn something new
or an alternate way to accomplish something. Thanks again! Take it
easy!
Megan