Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dCount Question with multiple criteria

Status
Not open for further replies.

kbrown73

MIS
Sep 9, 2004
32
US
I am trying to count the number of records in an Access database table based on double criteria. Here goes:

child = DCount("[Status]", "[othersinhousehold]", "[Status] = 'Child'" And "[customerid] = " & "'" & ID & "'")

"Status" is either "Child" or "Adult"
"customerid" is based on the ID of the Customer in the "Customers" table.

Trying to tally how many children and how many adults live with the customer.

"Othersinhousehold" is a table linked to "Customers" via Customerid field.

With the above dCount Statement, I receive "Type Mismatch" error.

Child is Integer
 
Try removing the quotes around the AND keyword.
child = DCount("[Status]", "[othersinhousehold]", "[Status] = 'Child' And [customerid] = '" & ID & "'")
 
I thought that I tried that scenario. It works. Thanks...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top