preview report from form

laurat

Registered User.
Local time
Today, 17:50
Joined
Mar 21, 2002
Messages
120
I am trying to place a button on a form to preview a report, I want the report to open and display the same record that is in the form. Here is the code I used in the On_Click event of the button

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "VIR Info Report"


stLinkCriteria = "[IRR#]=" & Me![IRR#]
DoCmd.OpenReport stDocName, , , stLinkCriteria

The problem is that it is printing the report at as well as displaying it on the screen. Does anyone know why this is happening and how I can fix it? Thanks.
 
Correction

It does not display on the screen, just prints it out. I would just like it to display on the screen, NOT print out.
 
DoCmd.OpenReport stDocName, acPreview etc
 
I tried that, the problem with that is that it just opens to the first record in the table. I need to link the form and report so that it opens the report to the same record that is open in the table. For example if the form was open to the record with IRR# 123, I want the report to automatically open up to display the record with IRR# 123.
 

Users who are viewing this thread

Back
Top Bottom