MRDIRK
03-09-2007, 10:39 AM
Could someone please explain what impact using "*" in place of the [CITY] field name would have in my report query? Both of these seem to work, but I was wondering if one line would be more of a detriment that the other. I mean, is there a chance that using the line with the "*" might not give me the results I want or slow the search down. I gather that using the "*" causes the query to evaluate more than just the [CITY] field, but I'm not sure. If it does, I probably don't want to use the "*". Any advice?
=DCount("[CITY]", "tblMembers", "[CITY] = 'Baltimore' AND [HOBBY] = 'Golf'")
=DCount("*", "tblMembers", "[CITY] = 'Baltimore' AND [HOBBY] = 'Golf'")
Thanks a heap,
Mr Dirk
rainman89
03-09-2007, 10:49 AM
the city portion is more direct and, if that is what u are trying to count, that makes it a more distinct query
The Star doesnt tell what u are counting. it just counts all te fields where that criteria is met
pbaldy
03-09-2007, 11:12 AM
My understanding is that the wildcard will be more efficient in that situation, since Access won't have to evaluate that field. Your criteria has already restricted the records, so having an additional criteria on City is not necessary.
sclark
03-09-2007, 11:30 AM
The "*" (all) qualifier would cause the query to search all records in the table, then give you the entries that match you additional qualifiers. If your data table was large, the "*" should cause the query to be slower than the query using the "CITY" qualifier. With a relatively small data table, you should notice no difference.
pbaldy
03-09-2007, 12:57 PM
The function will search all records in the table anyway, to find those that meet the criteria. I was curious so I ran a little test, on a table with 200k records and a loop that ran a DCount 100 times. The difference between the 2 methods was negligible, to the point that I wouldn't call either one a winner.
MRDIRK
03-09-2007, 03:37 PM
Wow! What a wonderful response. I didn't realize my little question would result in a good little discussion. You've answered my questions. Thanks a heap!
Mr Dirk