i only want to print the current report !

anthonyevans

Registered User.
Local time
Today, 20:40
Joined
Mar 15, 2001
Messages
29
Dear All,

On my form I have placed a button to print that record in report form, but on hitting this button it proceeds to print the whole database ! I only want to print the ONE report from the current form.

Help !

Thankyou in advance for your help.

Anthony Evans
 
Hi,

If you hve an ID number on the screen
you can reference it in the query behind
the report.


eg in the criteria put

like forms!yourform!ID

This will just print the record on screen

cheers

bob
 
Thanks Bob.

Sorry for being so meticulous but the following is the code for that print button and I do have an ID which is Serial_Number. So in the following code where and what exactly do i add ?

Private Sub printreport_Click()
On Error GoTo Err_printreport_Click

Dim stDocName As String

stDocName = "Treatment Report"
DoCmd.OpenReport stDocName, acNormal

Exit_printreport_Click:
Exit Sub

Err_printreport_Click:
MsgBox Err.Description
Resume Exit_printreport_Click

End Sub


Thankyou in advance for your kind help.

Anthony Evans
 
Hi,

Put a query behind the report if you
don't already have one. Then in the
criteria of serial_number put a
reference to the serial_number on your
form.

You could filter the report but it's more
reliable to use a query

cheers

bob
 
Look up the OpenReport Method in help. You'll see the option for adding a filter. Usually the button wizard gives you this option when you select the print option.
 

Users who are viewing this thread

Back
Top Bottom