custom command button for printing

A

Andrina

I have a command button set to print a form. But it
prints ALL records and I only want it to print the current
record. How can I idiot proof this so when the form is
open and the user clicks print, only the current record is
printed and the button itself is not printed on the form?
 
J

Jim Allensworth

I have a command button set to print a form. But it
prints ALL records and I only want it to print the current
record. How can I idiot proof this so when the form is
open and the user clicks print, only the current record is
printed and the button itself is not printed on the form?
First don't use a form use a report for printing. Forms are for
viewing and interacting with data. Reports are for hard copies.
Base the report on the same data as the form; then to print it...

To open a report for a specific record use it's WHERE argument...
DoCmd.OpenReport "rptMyReport",,,"RecordID=" & Me.RecordID

This assumes a numeric ID. If it is text then wrap the ID in single
quotes.

- Jim
 

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