Open Report and set the Record Source.

spcepickle

Registered User.
Local time
Yesterday, 23:15
Joined
Jan 8, 2008
Messages
30
Good afternoon - I have a form that opens a report with a button coded:

stDocName = "CheckWhenReport"
DoCmd.OpenReport stDocName, acPreview


The report opens and the code on load is:
Me.RecordSource = Forms!RequestForm.QName

Then an error box pops up: You can't set the Record Source Property in print preview or after printing has started.

I tried: DoCmd.OpenReport stDocName, acNormal
but it starts printing before I get to see the report and that is not okay.

Any ideas on how I can open the report?

Thanks!
Amelia
 
Where is the code? I set the recordsource in the open event all the time.
 
Where is the code? I set the recordsource in the open event all the time.

I am not sure what you mean by open event. There is code in the "on click" part of the button and the "on load" part of the report I am trying to open.

Thanks!
Amelia
 
Try the report code in the On Open event.
 
When you say that "the code on load is:", do you mean that there is a subroutine that looks like this:
Private Sub Report_Open(Cancel As Integer)
Me.RecordSource = Forms!RequestForm.QName
End Sub

?
 
Private Sub Report_Open(Cancel As Integer)
Me.RecordSource = Forms!CheckWhenRequest.FiQu
End Sub

Works!

Thanks! :D
 

Users who are viewing this thread

Back
Top Bottom