Further bit of code after the statement Me.FilterOn = True
Private Sub Form_Open(Cancel As Integer)
Dim datDate As Date
Dim strDate As String
DateasString.Visible = False
FilterDate.Visible = False
datDate = Date
strDate = Left(datDate, 5)
Me.Filter = "FilterDate = '" & strDate & "'"
Me.FilterOn = True
'This section prevents the form from opening when the FilterDate field has no matching records
If Me.RecordsetClone.RecordCount = 0 Then
MsgBox "No matching record found", vbInformation, "Nothing found"
DoCmd.Close acForm, "Form"
Else
End If
End Sub