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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing a report from a Form 1

Status
Not open for further replies.

EdLentz

Technical User
Mar 20, 2002
85
US
Hi
I have a form that has a subform that is based on a query to show records that match a field on the main form. I want to print out a report with only the records in the subform that match the main forms' field. I cna't seem to find how to make this work.

Thanks
Ed
 
I'll assume you have a command button to print the subform records.
Let's say the report is called rptSubForm.
And the main form text box is called txtMain.
And the field in the sub form record which is linked to the main form record is called fldMainLink.

Put the following line of code in the OnClick event of the print command button.

DoCmd.OpenReport "rptSubForm", acViewNormal, , [fldMainLink] = Forms![frmMain]![txtMain]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top