acHidden Not Working... (1 Viewer)

saross

Registered User.
Local time
Today, 21:34
Joined
Mar 4, 2003
Messages
120
Hi all. I've searched the forums and can't find an answer to this I'm afraid... can someone help? I learned how to set a form as acHidden in my database so that I can check first that there are records matching the search-criteria and then make it visible if there are... However, it doesn't appear to be working for one of my forms... are there instances when a form won't appear as visible? On the form in question I have a couple of Call functions in the OnOpen action... would that interfere with it being 'hidden'?

Any help/ideas please?
 

RuralGuy

AWF VIP
Local time
Today, 14:34
Joined
Jul 2, 2005
Messages
13,825
What is the code you are using that does not work? Are you having trouble getting the form Visible? What is the test you are making to determine if you want to make the form visible or not?
 

ghudson

Registered User.
Local time
Today, 16:34
Joined
Jun 8, 2002
Messages
6,194
If you had searched the forum then you would have found a few variations of this code which will close the form if the record source contains no records. Put it in the forms OnOpen event.
Code:
Private Sub Form_Open(Cancel As Integer)
    
    If Me.RecordsetClone.RecordCount = 0 Then
        MsgBox "There are zero records in the data source!", vbInformation, "No Records Found"
        DoCmd.Close acForm, Me.name
    End If
    
End Sub
 

Users who are viewing this thread

Top Bottom