count records with multiple criteria in VBA (1 Viewer)

jeannier1975

Registered User.
Local time
Today, 04:52
Joined
May 17, 2018
Messages
48
I have many queries were simply to come up with a number that is a count of records with a specific criteria, to be used later in a calculation. Because those criteria are so lengthy, and change with each variation of the data that is collecting, I’m not sure if an IIF structure would return the results you want. Crosstab queries can get quirky when fields are not available on different data runs. I want to do most (if not all) of the count-collecting in VBA using recordsets or the DCOUNT() function. Then I want dumping the values into a temporary table and base the report off of that. The queries I already have built are doing pretty much what I described, but when you try to link them together for the final report, if anything had missing or null values, it causes problems. Doing the work in VBA gives me much more flexibility in handling these situations.
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 04:52
Joined
Aug 30, 2003
Messages
36,124
I moved your thread out of the moderated sample databases forum. I'm not seeing a specific question. Were you just providing this as a potential solution for others?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 04:52
Joined
Oct 29, 2018
Messages
21,454
Hi. Did you need help with the VBA code you're trying to build? What do you have so far?
 

jeannier1975

Registered User.
Local time
Today, 04:52
Joined
May 17, 2018
Messages
48
i'm trying to build a function the counts the records with multiple criteria and divide theat criteria with some count of another criteria to get a percentage. I don't know VBA so i need help.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 04:52
Joined
Oct 29, 2018
Messages
21,454
i'm trying to build a function the counts the records with multiple criteria and divide theat criteria with some count of another criteria to get a percentage. I don't know VBA so i need help.
Okay, can you post a sample copy of your database with test data only? Please tell us which tables and which fields to count and also tell us the criteria you want to use.
 

Users who are viewing this thread

Top Bottom