Hi Everyone:
I have an unbound form where the user enters a number "cboPS" which corresponds to a record. Another form opens with that number's data. But if there are no numbers that match, how can I get a message box to appear and tell the user. Then have the form stay open for another number?
Private Sub OpenDetails_Click()
On Error GoTo Err_OpenDetails_Click
Me.Visible = False
Dim strWhere As String
strWhere = "1=1 "
If Not IsNull(Me.cboPS) Then
strWhere = strWhere & " And [PS_No]='" & _
Me.cboPS & "' "
End If
DoCmd.OpenForm "FrmCat", acNormal, , strWhere
' DoCmd.OpenForm "FrmFindAnimalInfo", acNormal, , strWhere
Exit_OpenDetails_Click:
Exit Sub
Err_OpenDetails_Click:
Msgbox "PS does not exist, try another"
Resume Exit_OpenDetails_Click
End If
End Sub
Sophia
I have an unbound form where the user enters a number "cboPS" which corresponds to a record. Another form opens with that number's data. But if there are no numbers that match, how can I get a message box to appear and tell the user. Then have the form stay open for another number?
Private Sub OpenDetails_Click()
On Error GoTo Err_OpenDetails_Click
Me.Visible = False
Dim strWhere As String
strWhere = "1=1 "
If Not IsNull(Me.cboPS) Then
strWhere = strWhere & " And [PS_No]='" & _
Me.cboPS & "' "
End If
DoCmd.OpenForm "FrmCat", acNormal, , strWhere
' DoCmd.OpenForm "FrmFindAnimalInfo", acNormal, , strWhere
Exit_OpenDetails_Click:
Exit Sub
Err_OpenDetails_Click:
Msgbox "PS does not exist, try another"
Resume Exit_OpenDetails_Click
End If
End Sub
Sophia