I need to produce rptOccurCode from frmParameters having combo box cboAbsenceCode. The user selects a code from the combo box and produces the report. This works fine, however, if there are no results to show, I would like a MsgBox to display to notify the user that no results were found, and no report will be produced.
I am slowly learning VB, but here is what I currently have:
Any thoughts on what I need to do/change?????
Thanks soooo much!
KMK
I am slowly learning VB, but here is what I currently have:
Code:
Private Sub Ok_Click()
If IsNull(Me.StartDate) And IsNull(Me.EndDate) And IsNull(Me.cboAbsenceCode) Then
MsgBox "You must first select an Absence Code and " _
& vbCrLf & "enter the Start Date and End Date to preview the report. "
GoTo Exit_OK_Click
End If
If Not IsNull(Me.cboAbsenceCode) Then
DoCmd.OpenReport "rptOccurCode", acViewPreview
GoTo Exit_OK_Click
End If
If rstOrd.RecordCount = 0 Then
MsgBox "There are no Occurrences to Print ", vbOKOnly, " frmParameters "
GoTo Exit_OK_Click
End If
Exit_OK_Click:
Me.cboAbsenceCode.SetFocus
Exit Sub
End Sub
Any thoughts on what I need to do/change?????
Thanks soooo much!
KMK