Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

REPORT QUERY PROBLEM HELP!

Status
Not open for further replies.

johngordon

Technical User
Jun 29, 2002
112
US
I have a query that when executed prompts me to enter a name. This in turn opens a form which shows only the records of the filtered name.

I created a button that will open the report. The problem is that it prompts me to the enter name again when the report opens. How can I get the report to open with out typing the name a second time.

The form is based on the query and the report is also based on the same query. What am I doing wrong and how do I correct this problem?

Thanks,

John
 
John,
I wrote an FAQ on how to use a filter to open a report and only show the desired records.
faq703-2657
Obviously, your form already has the name. This name field can be passed to the report as follows:
dim strFilter as String
strFilter = "[fldName] = '" & Me!Name & "'"
DoCmd.OpenReport "rptYOURREPORT", acViewPreview, , strFilter

This example presumes that the field on your form is "Name", and that the field in your report's field list is "fldName". Replace "rptYOURREPORT" with the name of the report you are opening.
HTH,
Randy Smith
California Teachers Association
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top