Using Data from a Report in a Form

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.
 
J

Jeff Boyce

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
 
D

Dave

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.
 
D

Dave

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"]
 

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

Top