By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,948 Members | 1,958 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,948 IT Pros & Developers. It's quick & easy.

Print Single record vs whole report

P: 27
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?
Apr 1 '10 #1

✓ answered by ADezii

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.
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenReport "rptEmployees", acViewNormal, , "[EmployeeID] = " & Me![EmployeeID], acWindowNormal

Share this Question
Share on Google+
2 Replies


ADezii
Expert 5K+
P: 8,638
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.
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenReport "rptEmployees", acViewNormal, , "[EmployeeID] = " & Me![EmployeeID], acWindowNormal
Apr 1 '10 #2

P: 27
Thanks! I was trying to do it through the reports open event and getting nowhere
Apr 2 '10 #3

Post your reply

Sign in to post your reply or Sign up for a free account.