Report From Form

halem2

Registered User.
Local time
Today, 06:36
Joined
Nov 8, 2006
Messages
180
Hi:

using Access 2000. I have a form called frmLocation that's populated from a qryLocation, which prompts user to enter a specific location to display using field Location. I also created a report from the same qry.

I created a macro that would run the report from the frmLocation but it keeps prompting for the Location. It is supposed to "read" the Location field from the form frmLocation and open the rptLocation showing the same location shown in the form.

This is what I have in the macro:

Under ACTION: OpenReport

then under

Report Name: rptLocation
View: Print Preview
Filter Name:
Where Condition: [Location]=[Forms]![frmLocation]![Location]


When I call the macro from the form it prompts again for the Location.

Any ideas how to make this work? I thought I had it but I guess not...
 
Is there a field called Location in the query qryLocation?
 
qryLocation will run when the action Open Report is taken and as that qry prompts for a Location you will be prompted.
I have never used the macro where clause as I don't use macros but a quick read suggests that it is used to filter for the Report regardless of any previous filtering.
A quick fix would be to create a 2nd qry identical to the first except that the criteria references the form rather than prompting, and change the report source.

Brian
 
:D thanks guys. I did it using VBA. thanks again.
 

Users who are viewing this thread

Back
Top Bottom