How to: print out a FORM with only the one active record

  • Thread starter Martin \(Martin Lee\)
  • Start date
M

Martin \(Martin Lee\)

I create a button in a FORM with VBA as:

DoCmd.PrintOut

However, it will print out as many as all the existing records

I want it to print out a FORM only with current record. How to modify the
VBA?

Thanks!

Martin
2008-02-14
 
A

Albert D. Kallal

Martin (Martin Lee) said:
I create a button in a FORM with VBA as:

DoCmd.PrintOut

However, it will print out as many as all the existing records

I want it to print out a FORM only with current record. How to modify the
VBA?

The recommended approach here is to design and layout of report that looks
like your form, for the most part when you attempt to print things you have
all kinds additional difficulties such as the background for shading of the
form eccentric, user report to print out.

The code to send the ONE record to the report is:

me.Refresh
docmd.OpenReport "nameofReprot",,,"id = " & me!id

The me.refresh forces a disk write (so the report can see any changes), and
the open report has a "where" clause that restricts the record to the
current primary key (usually id in most cases).
 

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