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

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

vba coding 4
query for latest course 0
Make a field mandatory when another one changes 2
SQL wizards 1
Access ID 3
query for latest course 1
dcount function in a subform 1
find date clashes 2

Top