T
Tray
I'm created a dialog box (named "Test") that appears when the 'All Quotes'
report is opened. The reason is for the user to input Beginning Dates and End
Dates so only the quotes between those dates are included. I'm basing it on
the 'Sales By Year' report in the Access example database, Northwind.
The form appears when the report is selected but when I click 'OK', the
error message appears.
This is the event procedure I have for when the OK button is clicked:
Private Sub OK_Click()
On Error GoTo Err_OK_Click
Dim strMsg As String, strTitle As String
Dim intStyle As Integer
If Not Reports![All Quotes].blnOpening Then Err.Raise 0
Me.Visible = False
Exit_OK_Click:
Exit Sub
Err_OK_Click:
strMsg = "To use this form, you must preview or print the All Quotes
report from the Database window or Design view."
intStyle = vbOKOnly
strTitle = "Open from Report"
MsgBox strMsg, intStyle, strTitle
Resume Exit_OK_Click
End Sub
And this is the On Open event procedure for the All Quotes report:
Private Sub Report_Open(Cancel As Integer)
Dim strDocName As String
strDocName = "Test"
blnOpening = True
DoCmd.OpenForm strDocName, , , , , acDialog
If IsLoaded(strDocName) = False Then Cancel = True
blnOpening = False
End Sub
Can anyone see why an error is caused when I click OK??
report is opened. The reason is for the user to input Beginning Dates and End
Dates so only the quotes between those dates are included. I'm basing it on
the 'Sales By Year' report in the Access example database, Northwind.
The form appears when the report is selected but when I click 'OK', the
error message appears.
This is the event procedure I have for when the OK button is clicked:
Private Sub OK_Click()
On Error GoTo Err_OK_Click
Dim strMsg As String, strTitle As String
Dim intStyle As Integer
If Not Reports![All Quotes].blnOpening Then Err.Raise 0
Me.Visible = False
Exit_OK_Click:
Exit Sub
Err_OK_Click:
strMsg = "To use this form, you must preview or print the All Quotes
report from the Database window or Design view."
intStyle = vbOKOnly
strTitle = "Open from Report"
MsgBox strMsg, intStyle, strTitle
Resume Exit_OK_Click
End Sub
And this is the On Open event procedure for the All Quotes report:
Private Sub Report_Open(Cancel As Integer)
Dim strDocName As String
strDocName = "Test"
blnOpening = True
DoCmd.OpenForm strDocName, , , , , acDialog
If IsLoaded(strDocName) = False Then Cancel = True
blnOpening = False
End Sub
Can anyone see why an error is caused when I click OK??