Count question

L

Lori

I am trying to have a field on my form that counts the number of records with
an Active or Change of Ownership status code within a zip code/local agency
combination. The Change of Ownership criteria is something that I am adding
(my code was working when it was just counting the Active status records).
The first set of code below is worked with just one Status criteria, the
second set is what I am trying that doesn't work. I need to total of all
records with Active or Change of Ownership status. The code is off of the On
Current event:

This worked with just Active status:

If Me.DataEntry = False Then
Current_Vendor_Count = DCount("*", "tbl_Vendor", "(tbl_Zip_Code.Zip_Code =
tbl_Vendor.P_Zip_Code) AND (tbl_Zip_Code.Local_Agency_Code =
tbl_Vendor.Local_Agency_Code) AND [Status_Code] = ‘Active’ AND
[Peer_Group_Code] <> 11 ")
End If

This is the code where I tried to add a second Status criteria and it
doesn't count the records correctly (I'm not getting an error, just not the
correct count)

If Me.DataEntry = False Then
Current_Vendor_Count = DCount("*", "tbl_Vendor", "(tbl_Zip_Code.Zip_Code =
tbl_Vendor.P_Zip_Code) AND (tbl_Zip_Code.Local_Agency_Code =
tbl_Vendor.Local_Agency_Code) AND ([Status_Code] = 'Active' or [Status_Code]
= 'Change of Ownership/Inc in Process') AND [Peer_Group_Code] <> 11 ")
End If


Thanks for any help!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Count code 3
run time error 2001 2
table design - calculated field 1
Criteria 4
Record Count 1
On Current event 5
Help! - calculated control 6
On Current event 3

Top