Print current record on form

  • Thread starter Thread starter Deb Struble
  • Start date Start date
D

Deb Struble

How do I get a report to print the information based on the current record
in a form? For example, the user would enter the record through a form and
then click on a print button on the form. It would then print only the
current record.
Thanks!
 
Deb said:
How do I get a report to print the information based on the current
record in a form? For example, the user would enter the record
through a form and then click on a print button on the form. It
would then print only the current record.
Thanks!

The OpenReport Method has an optional WHERE argument that can be used to
filter the report before previewing or printing. Basically you need to use
that to apply a filter that mathces the primary key field(s) on the cirrent
record.

Example with a single field key named "ID"...

DoCmd.OpenReport "ReportName", acViewPreview,, "ID = " & Me!ID

In case it's a new record or a record that the user might have edited it is
a good idea to also save the record first.

Me.Dirty = False
DoCmd.OpenReport "ReportName", acViewPreview,, "ID = " & Me!ID
 
Back
Top