I have a report that prints all of the records out from a table, usually executed from a reports menu. The user also wants a print button on the data entry form that will print out the exact same report but only for that record. Is there trick so I can use the report but limit it to printing out the single record?
Print Single record vs whole report
Collapse
X
-
Tags: None
-
You can accomplish this by setting the WHERE Condition of the OpenReport Method to point to the Current Record. The following code, executed from an Employees Form, will Print a single Record reflecting the currently displayed Employee. This is done by passing the [EmployeeID] (Primary Key) to the WHERE Argument so that the Report reflects only a single Employee.
Code:DoCmd.OpenReport "rptEmployees", acViewNormal, , "[EmployeeID] = " & Me![EmployeeID], acWindowNormal
-
Comment