Count code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to do a count of records within a textbox at the form's on
current event. The following is my code (which isn't working), I am not
getting an error message - just the wrong count.

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 ")

Any help is greatly appreciated!
 
It's look like you want to join two tables, and then run the DCount.
You can't join two tables in a DlookUp statement, you can search on one
table at a time.
So, create a query that join the two tables, with the right filter, and then
run the count on the query you created

Dcount("*","QueryName")

You can also leave the criteria in the dcount insted of the query

Dcount("*","QueryName","[Status_Code] = 'Active' AND [Peer_Group_Code] <> 11
")
 
AUTO-REPLY From George Levitt

Please allow this to confirm a system receipt of your e-mail.

I am out of the office until Wednesday morning (1/12/05) and will not be
reviewing or responding to email or voicemail until that time.

I look forward to replying to your message on Wednesday.

Thanks and warmest regards, George
 
AUTO-REPLY From George Levitt

Please allow this to confirm a system receipt of your e-mail.

I am out of the office until Wednesday morning (1/12/05) and will not be
reviewing or responding to email or voicemail until that time.

I look forward to replying to your message on Wednesday.

Thanks and warmest regards, George
 

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

run time error 2001 2
table design - calculated field 2
Help! - calculated control 6
Criteria 4
Record Count 1
On Current event 3
On Current event 5
Count Records for this week, this month, this quarter, this year 5

Back
Top