Print Preview based on data already visible in a form

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
 
D

Duane Hookom

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top