G
Guest
Greetings,
I am working on an employee database and have a query that searches
predefined job classifications for matches with employee qualifications.
Sometimes no match is found. When this happens, the form in which the query
results are displayed comes up blank.
I want to trap this error, give the user a message box that instructs them
to change their criteria and closes the blank form.
I have tried several variations on the following code:
Private Sub Form_Load()
Dim strMsg As String, strTitle As String
Dim intStyle As Integer
If Me.RecordSource = Null Then
strMsg = "Your search returned no results. Try changing " _
& " your search criteria, then search again."
intStyle = vbOKOnly
strTitle = "Please Try Again"
MsgBox strMsg, intStyle, strTitle
DoCmd.Close acForm, "frmEmpJobMatchRslts"
End If
End Sub
Anyone have any other ideas?
Thanks...
I am working on an employee database and have a query that searches
predefined job classifications for matches with employee qualifications.
Sometimes no match is found. When this happens, the form in which the query
results are displayed comes up blank.
I want to trap this error, give the user a message box that instructs them
to change their criteria and closes the blank form.
I have tried several variations on the following code:
Private Sub Form_Load()
Dim strMsg As String, strTitle As String
Dim intStyle As Integer
If Me.RecordSource = Null Then
strMsg = "Your search returned no results. Try changing " _
& " your search criteria, then search again."
intStyle = vbOKOnly
strTitle = "Please Try Again"
MsgBox strMsg, intStyle, strTitle
DoCmd.Close acForm, "frmEmpJobMatchRslts"
End If
End Sub
Anyone have any other ideas?
Thanks...
