Printing a blank report

  • Thread starter Thread starter Joan
  • Start date Start date
J

Joan

Hi,
Maybe it is because it is late and my brain is not functioning because I
can't seem to remember how to print a blank report. It would seem that
there would be no record source for the report in this instance. However,
one can't change the record source of the report after it is opened. I don't
know if you can change the record source in the On Activate event or not.?
I have another button on the form which will open the report at a selected
record which I have working fine. However, opening a blank report has me
stumped.

Can someone help me out with this?

Joan
 
Joan:

There's couple ways to achieve this.

1.) Of course you can change the recordsource in the On Open event, but if
you have bound controls this will cause the report to complain if the
recordsource is blank.
2.) Better still, open your report with a filter specified where you know it
won't return records.
 
Steve,
Pardon my ignorance, but I have not used filters in VBA. How would I go
about this? I tried the following code on the click event of a command
button to open the report:

Private Sub cmdPrintBC_Click()
Dim stFilter As String
Dim stDocName As String
stFilter = (((BookingConfirmQuery.[Booking Number]) = -1))
stDocName = "BookingConfirm"
DoCmd.OpenReport stDocName, acViewPreview, stFilter
End Sub

However I get the message: Runtime error 424. Object required.
What am I missing here?

Joan
 
Back
Top