Print Preview based on data already visible in a form

  • Thread starter Thread starter Ian
  • Start date Start date
I

Ian

Good afternoon all,

I would like to be able to print a report based on the
record that is currently visible on a form. At present I
just use a query activated from a macro and it asks me
which record I woould like to preview.

Any clues would be greatly appreciated.

Ian
 
You should have a primary key value in the current record. Assuming this is
a numeric field named ID. Your code to open the report might be:
Dim strWhere as String
strWhere = "[ID]=" & Me.ID
DoCmd.OpenReport "rptYourReport", acViewPreview, , strWhere
 
Back
Top