Solved

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

Posted on 2015-02-19
4
110 Views
Last Modified: 2015-02-19
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:

=[Forms]![frmCCOrder]![frmCCFormLineItems].[txtProject]

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?
0
Comment
Question by:Shooter54
  • 2
4 Comments
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 40619248
You refer to a Subform like this:

Forms!ParentForm!NameOfYourSubformCONTROL.Form.NameOfTheControlOnTheSubform

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
0
 

Author Comment

by:Shooter54
ID: 40619284
Thanks! Quick fix to what should have been a simple issue.
=[Forms]![frmCCOrder]![frmCCFormLineItems].[Form].[txtProject]
instead of
=[Forms]![frmCCOrder]![frmCCFormLineItems].[txtProject]
0
 

Author Closing Comment

by:Shooter54
ID: 40619285
Speedy response, saved the day! Thanks again.
0
 
LVL 12

Expert Comment

by:FarWest
ID: 40619288
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
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question