DCount function

  • Thread starter Thread starter lynn atkinson
  • Start date Start date
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)
 
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
 
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)
.
.
 
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)
.
.
.
 
Back
Top