Using Data from a Report in a Form

  • Thread starter Thread starter Dave
  • Start date Start date
D

Dave

I was wondering if anyone knows how to:

Click on a value in a report which would then have access open up a form in
add mode using the value from the report to populate the corisponding field
in the form.

for example:
Report of Orders displays Customer ID, Customer Name, Customer Address and
Last date of order. When you click on Customer ID, it would open up the Order
form in add mode, populating the customer ID field from the report.

Thank you so much for your assistance, cant seem to find out the answer
anywhere and hoped someone here would konw how to do this.
 
A classic approach to forms and reports is to use a query to "feed" them.

If the data that's been collected for display in a report is collected via a
query, I'd think that query would be available to feed a form, too.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Thank you also Jeff. Think I'm going to try your suggestion. It wont be as
clean as clicking on a record displayed in a report, but it will accomplish
the functionality needed.
 
I figured I'd give it one more shot yesturday before giving up and discovered
teh solution. I just wanted to place this update in case anyone else came
looking at how to do what I was requesting.

SOLUTION:
Everything in ' ' is names withing Access 2007.
Everything in " " is names that you need to change to match ur dB.

In 'DESIGN' view of the Report, select the field you want to link on click.
In the 'Property Sheet' of that field, go into the 'EVENT' tab.
At the 'On Dbl Click' entry, create the following macro:

RemoveTempVar Name: "MyVar"

SetTempVar Name: "MyVar"
Expression: "[Reports]!["REPORT NAME"]!["FIELD NAME"]

OpenForm Form Name: "FORM NAME YOU WANT TO OPEN"
View: 'Form'
Filter Name:
Where Condition:
Data Mode: 'ADD'
Window Mode: 'Normal'

SetValue Item: [Forms]!["FORM NAME FROM OpenForm
COMMAND"]!["FIELD NAME YOU WANT TEMP VALUE TO BE ENTERED"]
Expression: [TempVars]!["MyVar"]
 
Back
Top