custom command button for printing

  • Thread starter Thread starter Andrina
  • Start date Start date
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?
 
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
 
Back
Top