adding another criteria

L

lynn atkinson

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
 
A

Allen Browne

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