Function IsThereFormData(frm As Form) As Integer
Dim Ctrl As Control
For Each Ctrl In frm.Controls
'Un-Rem lines below to check only TextBoxes.
'If Ctrl.ControlType = acTextBox Then
If Not IsNull(Ctrl) Then IsThereFormData = 1:Exit For
In the On Open event of your Form:
If IsThereFormData(Me) = 0 Then
MsgBox "No data found in Form to display"
Cancel = True
But in my opinion, your query should never allow for a blank form. A message should display instead indicating that there were no results from the query.