I just read machineboy's problem, and it is very similar to mine, but enough different for me to start a different thread "I think".
I created a macro with a MsgBox to appear when the NOData event happened. Then "CancelEvent". The msg box worked perfectly. BUT, then I got the following message
"The OpenReport action was canceled. You used a method of the DoCmd object to carry out an action in Visual Basic, then then clicked Cancel in a dialog box. For example, you used the Close method to close a changed form, then clicked Cancel in the diaqlog box that asks if you want to save the changes that you made to the form."
When I said "OK" to the Access message, the form was there just like I wanted it to be.
QUESTION: How can I stop the Access generated message from appearing?
DUH??
Here is the code behind "on click" on the form that causes the report to Preview.
Private Sub PLMReport_Preview_Click()
On Error GoTo Err_PLMReport_Preview_Click
If Me.Dirty Then
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
End If
Dim stDocName As String
stDocName = "PLM Product Report"
DoCmd.OpenReport stDocName, acPreview
Exit_PLMReport_Preview_Click:
Exit Sub
Err_PLMReport_Preview_Click:
MsgBox Err.Description
Resume Exit_PLMReport_Preview_Click
End Sub
:
Deb Koplen
deb.koplen@verizon.com
A person can stand almost anything except a succession of ordinary days.
I created a macro with a MsgBox to appear when the NOData event happened. Then "CancelEvent". The msg box worked perfectly. BUT, then I got the following message
"The OpenReport action was canceled. You used a method of the DoCmd object to carry out an action in Visual Basic, then then clicked Cancel in a dialog box. For example, you used the Close method to close a changed form, then clicked Cancel in the diaqlog box that asks if you want to save the changes that you made to the form."
When I said "OK" to the Access message, the form was there just like I wanted it to be.
QUESTION: How can I stop the Access generated message from appearing?
DUH??
Here is the code behind "on click" on the form that causes the report to Preview.
Private Sub PLMReport_Preview_Click()
On Error GoTo Err_PLMReport_Preview_Click
If Me.Dirty Then
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
End If
Dim stDocName As String
stDocName = "PLM Product Report"
DoCmd.OpenReport stDocName, acPreview
Exit_PLMReport_Preview_Click:
Exit Sub
Err_PLMReport_Preview_Click:
MsgBox Err.Description
Resume Exit_PLMReport_Preview_Click
End Sub
:
deb.koplen@verizon.com
A person can stand almost anything except a succession of ordinary days.