dcount function in a subform

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

Guest

I am trying to display the number of places booked on a course on a form. I
am using the following Dcount statement
=DCount("[status]","bookings","[event ID]=" &
[Forms]![multiplebookingsubfrm]![event ID] & "AND [status] IN
('booked','provisional')")
When I view the subform directly ie open multiplebookingsubfrm
I see the result OK. However when I view the data as a subform in situ in
the main form the control displays #Name?.
What do I need to do to make it display correctly on the form?

cheers
 
Hi,
The correct way to reference a control on a subform is:
Forms!mainForm!subFormControlName.Form!ControlName

Usually the subform container and the subform itself have the same name,
but not always. The container name is what you see when you have your form
that contains the subform open in design view.
 
Back
Top