I have a simple bit of code below but I need something added. All the code is doing is opening a form and filtering on a combo box value. It opens all cases where the status is open but if there are no open cases it takes me to a new record, how do I get my code to recognise that there are no cases and display a message box for me instead and then close the form?
Private Sub open_Click()
Dim stDocname As String
stDocname = "frmMain"
DoCmd.OpenForm stDocname
DoCmd.ApplyFilter , "Status ='Open"
End Sub
Private Sub open_Click()
Dim stDocname As String
stDocname = "frmMain"
DoCmd.OpenForm stDocname
DoCmd.ApplyFilter , "Status ='Open"
End Sub