PhoenixDon
MIS
A have a switchboard that opens a form. The data source for the form is a query that can return ZERO records. How can I prevent the form from opening if there are NO records, or at least display a message, then close the form.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Private Sub Form_Open(Cancel As Integer)
Dim strRecError
If Me.RecordSource <> "" Then
If Me.Recordset.RecordCount = 0 Then
strRecError = "No Records. "
End If
Else
strRecError = "No recordset. "
End If
If strRecError <> "" Then
If MsgBox(strRecError & "Continue?", vbYesNo) = vbNo Then
Cancel = True
End If
End If
End Sub