adding another criteria

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

Guest

I have a dcount function which counts the number of places booked on a
course. The code is as follows

=DCount("[status]","bookings","[event ID]=" & [Forms]![bookingsfrm]![event
ID] & "AND [status] IN ('booked')")

This works OK, but I have discovered a problem. A person can be booked on a
course then leaves the company. His contract record is marked 'old' and
therefore does not show up on the subform - as specified in the query.
However, the booking still exists and is included in the count of places
booked.

How do I add a qualification to the above dcount statement to exclude 'old
contracts' from the count.
the 'old contract' field is held in the contractural table.

Hope this makes sense
 
Create a query that combines the Bookings table and the Peson table.

Replace "bookings" with the name of the query. You can then include the
extra field in the 3rd argument of the DCount(), e.g.:

=DCount("[status]","Query1","([event ID]=" & Nz([Forms]![bookingsfrm]![event
ID],0) & ") AND ([status] ='booked') AND ([old] = False)")
 

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

Access Dcount (multiple criteria) 3
DCount function 4
dcount in query 8
vba coding 4
input date in query 1
DCount() criteria 1
Access 2003 DCount Syntax Rookie 4
Problem with UNION Query 5

Back
Top