field counter, display no. of occurences in a table on a form

antonyx

Arsenal Supporter
Local time
Today, 15:22
Joined
Jan 7, 2005
Messages
556
hi,

in my table i have a customer id number.

each job will have one customer id number.. and customers will have many jobs to their id

i simply want to display on my form the number of times that customer's id has appeared in my bookings table.

eg.. a customer has used our services 25 times.. (so obviously their customer id is found 25 times in the booking table as a foreign key)

so can i just place a control on my form that displays this value (i presume it is some kind of counter)..

so i will know on my customer form how many times they have been included in a booking record
 
Use the DCount function. Check Access help for the syntax.
 
ok i have this

"intX"=DCount("[customerid]","bookings")

so far


customerid is the field i want to count.. bookings is the table i want to search through.. but i want to search through the 'customer' field aswell..

how can i change the code to do that

also do i put it in the control source of the textbox??
 
OK, assuming you have a text box on your form that contains the customer ID you are searching for, and it is called txtCustomerID:

=DCount("[CustomerID]", "[Bookings]", "[CustomerID] = " & txtCustomerID

Put that in the control source of an unbound text box.
 

Users who are viewing this thread

Back
Top Bottom