getting value for a report from a form based on current form

I have an unbound control or field on a report that I would like to get the contents from an active and open form. Using the following syntax doesn't seem to work for me:


frmCCOrder is the name of my main form, frmCCFormLineItems is the name of my subform where my control lies, and txtProject is the name of the control from which I want to retrieve my data.

All I get when I preview the form using this is ?Name.

Any idea what I may be doing wrong?
Who is Participating?
Scott McDaniel (Microsoft Access MVP - EE MVE )Connect With a Mentor Infotrakker SoftwareCommented:
You refer to a Subform like this:


The "NameOfYourSubformCONTROL" is the tricky part. It's a "container" control, and it's placed on your parent form, either by you or by Access. To determine the name, open the parent form in Design view, and click ONCE on the edge of the subform. Note the Properties box, Other tab - the value in the Name property is the one you want.

 Subform 2
Shooter54Author Commented:
Thanks! Quick fix to what should have been a simple issue.
instead of
Shooter54Author Commented:
Speedy response, saved the day! Thanks again.
I don't Think it will be possible to do that if the control is in details or group section of the report,
you can use global or public variable to hold the required value when report shown and access that variable
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.