dcount function in a subform

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
 
D

Dan Artuso

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.
 

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

calculation in a subform does not display 3
DCount function 4
DCount function 4
Access Dcount function in access 0
DCount problem redux 4
Still struggling with DCount 8
DCount with a subform 3
DCount alwaysreturning 1 0

Top