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

Displaying specific reports

Status
Not open for further replies.

Ptrif

Technical User
May 19, 2003
106
US
I have a form that shows individual emplyoee information, i want to add a button to the form that will open a report with the current employee in the report automatically, is there a way to accomplish this?

Paul
 
Use the Criteria parameter of the DoCmd.OpenReport call. This is the same as a SQL WHERE clause without the WHERE keyword. e.g.

DoCmd.OpenReport "rptEmployee", acViewPreview, ,"EmployeeID=" & Me.txtEmployeeID

Assumes your employee PK is called EmployeeID and is bound to a textbox on your form called txtEmployeeID.

Design your report so that it will return all employees. The criteria parameter then filters the results and only reports the ones that match.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top