checking Query content

jlabre01

Registered User.
Local time
Today, 13:05
Joined
May 26, 2008
Messages
62
hi,

i wanted to know if it was possible when loading a form could i check a query's content first. I needed to know if there is anything in the query or not. So if nothing is in the query then I don't have to view the sub form for the query

jlabre01
 
Use DCount() to count the number of records. If it's zero, then there's no data so don't run the query.
 
Haven't done this in a while, but I think you use the form's Open event

Code:
Private Sub Form_Open(Cancel as Integer)
   If Me.RecordsetClone.RecordCount=0 Then
      'don't open the form 
      Cancel=True
   End If
Exit Sub
 

Users who are viewing this thread

Back
Top Bottom