Close Form Attached to Query If No Records Found

  • Thread starter Thread starter Swantekmar
  • Start date Start date
S

Swantekmar

Guest
I have a query that shows its results in a Form View. The form works great as long as the query returns records that match the query criteria. The problem is that when there are no records that match the criteria the form is opened but none of the fields or command buttons are visible, so basically I am left with a blank screen. When I switch to the EDIT VIEW I can see that I am actually still in the actual form.

Is there a way to tell a query to close itself and/or the associated form if there are no matches for the criteria submitted?
 
FormLoad event If RecordsetClone.RecordCount=0 Then
DoCmd.Close
End If
 

Users who are viewing this thread

Back
Top Bottom