Print Single record vs whole report

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • simulationguy
    New Member
    • Feb 2010
    • 27

    Print Single record vs whole report

    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?
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    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

    • simulationguy
      New Member
      • Feb 2010
      • 27

      #3
      Thanks! I was trying to do it through the reports open event and getting nowhere

      Comment

      Working...