A
Amateur
I have the following command button code to execute some instructions:
Private Sub prepare_invoicenumbers_Click()
On Error GoTo Err_prepare_invoicenumbers_Click
Dim stDocName As String
stDocName = "invoicenumbers"
DoCmd.RunMacro stDocName
stDocName = "endofmonthinvoicebie30p"
DoCmd.OpenReport stDocName, acNormal
stDocName = "endofmonthinvoiceclientsnonpool"
DoCmd.OpenReport stDocName, acNormal
stDocName = "invoicenumbersdelete"
DoCmd.RunMacro stDocName
Exit_prepare_invoicenumbers_Click:
Exit Sub
Err_prepare_invoicenumbers_Click:
MsgBox Err.Description
Resume Exit_prepare_invoicenumbers_Click
End Sub
My problem is that if the print command:
DoCmd.RunMacro stDocName
stDocName = "endofmonthinvoicebie30p"
get's executed, it's printing as well an empty page (or better just the
background) even if in the query, where the report gets it's data, is no
record at all.
How can I change the code so that it is NOT printing a report without record?
Thanks for your help
Klaus
Private Sub prepare_invoicenumbers_Click()
On Error GoTo Err_prepare_invoicenumbers_Click
Dim stDocName As String
stDocName = "invoicenumbers"
DoCmd.RunMacro stDocName
stDocName = "endofmonthinvoicebie30p"
DoCmd.OpenReport stDocName, acNormal
stDocName = "endofmonthinvoiceclientsnonpool"
DoCmd.OpenReport stDocName, acNormal
stDocName = "invoicenumbersdelete"
DoCmd.RunMacro stDocName
Exit_prepare_invoicenumbers_Click:
Exit Sub
Err_prepare_invoicenumbers_Click:
MsgBox Err.Description
Resume Exit_prepare_invoicenumbers_Click
End Sub
My problem is that if the print command:
DoCmd.RunMacro stDocName
stDocName = "endofmonthinvoicebie30p"
get's executed, it's printing as well an empty page (or better just the
background) even if in the query, where the report gets it's data, is no
record at all.
How can I change the code so that it is NOT printing a report without record?
Thanks for your help
Klaus