DCount function

L

lynn atkinson

I have a form (bookingsfrm)which displays details of an
event. It contains a sub form (bookingqryfrm) which
details all the persons booked for that event. I want to
count how many people have booked or provisionally booked
for that event (ie on the subform
status= 'booked'or 'provisional')and display this total so
I can use it to calculate how many places are still
available.
So far, with the help I have had on this newsgroup, I have
managed to get the calcualtion to count the total no on
the subform filling the criteria, but cannot get it to
display per event on the bookingsfrm. ie event no 3 has 2
places booked and one provisional - should display "3" (it
is displaying the total for all events ie "7".)

the statement I am using is

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

Where am I going wrong? (the eventID appears on both the
master and the subform)
 
G

Gerald Stanley

You have not qualified the entryId crtieria. Try
=DCount("[bookingId]","Booking","[event ID] = " & Forms!
bookingSfrm![event ID] & " AND [status] IN
('booked','provisional')")

Hope That Helps
Gerald Stanley MCSD
 
L

lynn atkinson

I have tried this, but am still getting the same result -
ie total records instead of those related to the event. I
am trying this calculated field both on the parent form
and on the subform and getting the same result. Should it
be on the parent form which is where I want it)
Both forms are based on queries.
I am really stumped.
-----Original Message-----
You have not qualified the entryId crtieria. Try
=DCount("[bookingId]","Booking","[event ID] = " & Forms!
bookingSfrm![event ID] & " AND [status] IN
('booked','provisional')")

Hope That Helps
Gerald Stanley MCSD
-----Original Message-----
I have a form (bookingsfrm)which displays details of an
event. It contains a sub form (bookingqryfrm) which
details all the persons booked for that event. I want to
count how many people have booked or provisionally booked
for that event (ie on the subform
status= 'booked'or 'provisional')and display this total so
I can use it to calculate how many places are still
available.
So far, with the help I have had on this newsgroup, I have
managed to get the calcualtion to count the total no on
the subform filling the criteria, but cannot get it to
display per event on the bookingsfrm. ie event no 3 has 2
places booked and one provisional - should display "3" (it
is displaying the total for all events ie "7".)

the statement I am using is

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

Where am I going wrong? (the eventID appears on both the
master and the subform)
.
.
 
L

Lynn atkinson

Bingo!
It has worked. dont know what I changed from posting the
last reply and this one, but whatever, it is working.
Thanks for your help!


-----Original Message-----
I have tried this, but am still getting the same result -
ie total records instead of those related to the event. I
am trying this calculated field both on the parent form
and on the subform and getting the same result. Should it
be on the parent form which is where I want it)
Both forms are based on queries.
I am really stumped.
-----Original Message-----
You have not qualified the entryId crtieria. Try
=DCount("[bookingId]","Booking","[event ID] = " & Forms!
bookingSfrm![event ID] & " AND [status] IN
('booked','provisional')")

Hope That Helps
Gerald Stanley MCSD
-----Original Message-----
I have a form (bookingsfrm)which displays details of an
event. It contains a sub form (bookingqryfrm) which
details all the persons booked for that event. I want to
count how many people have booked or provisionally booked
for that event (ie on the subform
status= 'booked'or 'provisional')and display this total so
I can use it to calculate how many places are still
available.
So far, with the help I have had on this newsgroup, I have
managed to get the calcualtion to count the total no on
the subform filling the criteria, but cannot get it to
display per event on the bookingsfrm. ie event no 3 has 2
places booked and one provisional - should display "3" (it
is displaying the total for all events ie "7".)

the statement I am using is

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

Where am I going wrong? (the eventID appears on both the
master and the subform)
.
.
.
 

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

dcount function in a subform 1
DCount function 4
calculation in a subform does not display 3
conditional "count" calculation 3
adding another criteria 1
vba coding 4
Access ID 3
Still struggling with DCount 8

Top