J
Johnny
This should be fairly simple, but never for me. All I want to do is have my
MsgBox macro to pop up and say "No data for this report". My macro works
fine, but I cannot figure out the code for where I need it to pop up.
The basis is a simple form with text dates beginning and ending, plus two
drop down boxes with WorkCenter# OR ClassCode# (just basic 4 digit numbers
each). Then there is the option to print a report based on the criteria I
select. One report button for ClassCode# and a second button for
WorkCenter#. If the operator fails to put in a ClassCode# (for instance),
then selects the ClassCode# report button, the macro message box should pop
up with the above statement. How and where would I insert that macro request
into the code of the form? I tried this, but no luck:
Private Sub Report_by_WorkCenter#_Click()
On Error GoTo Err_Report_by_WorkCenter#_Click
Dim stDocName As String
If IsNull(Me!cbxWorkCenter#) Then
DoCmd mcrMsgBox
Exit Sub
End If
stDocName = "rptMFG QC Scrap Detail by WorkCenter#"
DoCmd.OpenReport stDocName, acPreview
Exit_Report_by_WorkCenter#_Click:
Exit Sub
Err_Report_by_WorkCenter#_Click:
MsgBox Err.Description
Resume Exit_Report_by_WorkCenter#_Click
End Sub
Any suggestions is greatly appreciated.
MsgBox macro to pop up and say "No data for this report". My macro works
fine, but I cannot figure out the code for where I need it to pop up.
The basis is a simple form with text dates beginning and ending, plus two
drop down boxes with WorkCenter# OR ClassCode# (just basic 4 digit numbers
each). Then there is the option to print a report based on the criteria I
select. One report button for ClassCode# and a second button for
WorkCenter#. If the operator fails to put in a ClassCode# (for instance),
then selects the ClassCode# report button, the macro message box should pop
up with the above statement. How and where would I insert that macro request
into the code of the form? I tried this, but no luck:
Private Sub Report_by_WorkCenter#_Click()
On Error GoTo Err_Report_by_WorkCenter#_Click
Dim stDocName As String
If IsNull(Me!cbxWorkCenter#) Then
DoCmd mcrMsgBox
Exit Sub
End If
stDocName = "rptMFG QC Scrap Detail by WorkCenter#"
DoCmd.OpenReport stDocName, acPreview
Exit_Report_by_WorkCenter#_Click:
Exit Sub
Err_Report_by_WorkCenter#_Click:
MsgBox Err.Description
Resume Exit_Report_by_WorkCenter#_Click
End Sub
Any suggestions is greatly appreciated.