I have a form that opens data in another form. But if I enter data that isn't in the database, it doesn't do anything, so I want a msgbox telling the user that they entered a case number that isn't in the database.
Maybe a dlookup, I'm not sure? Here's the code so far.
*******************************************************
Private Sub cmdOpenCaseinMainEntry_Click()
Dim rs As DAO.Recordset
If Trim(Me!txtOpenCase & " ") = "" Then
MsgBox "Please enter a case number", vbOKOnly, "Oops..."
Else 'this is where I need some code for a msgbox
Set rs = Forms!frmMainEntry.RecordsetClone
rs.FindFirst "CaseNumber=" & Me!txtOpenCase
If Not rs.NoMatch Then MsgBox "Case number not found." 'Forms!frmMainEntry.Bookmark = rs.Bookmark"
DoCmd.Close
End If
End
End Sub
Maybe a dlookup, I'm not sure? Here's the code so far.
*******************************************************
Private Sub cmdOpenCaseinMainEntry_Click()
Dim rs As DAO.Recordset
If Trim(Me!txtOpenCase & " ") = "" Then
MsgBox "Please enter a case number", vbOKOnly, "Oops..."
Else 'this is where I need some code for a msgbox
Set rs = Forms!frmMainEntry.RecordsetClone
rs.FindFirst "CaseNumber=" & Me!txtOpenCase
If Not rs.NoMatch Then MsgBox "Case number not found." 'Forms!frmMainEntry.Bookmark = rs.Bookmark"
DoCmd.Close
End If
End
End Sub