Example of Hiding or UnHiding a Form

  • Thread starter SureFireSolutions.com Inc.
  • Start date
S

SureFireSolutions.com Inc.

Hello, I'm using Access 2000.

Does anyone have an example of how to hide or unhide a form programmatically
?

Don @ SureFireSolutions
 
W

Wayne Morgan

To hide or unhide a form, it must be open or use the Window Mode argument in
the DoCmd.OpenForm call to open it hidden.

Examples:
Me.Visible = False
Me.Visible = True

Forms!Form1.Visible = False
Forms!Form1.Visible = True

DoCmd.OpenForm "Form1",,,,,acHidden
 
S

SureFireSolutions.com Inc.

Thanks Wayne !

Will I'm thinking of it would you have an example of the Show or Hide method
?
I'm finding this example confusing...when I tried replacing UserForm1 with
the name of the form it wouldn't work for me ?

************
' This is the Initialize event procedure for UserForm1
Private Sub UserForm_Initialize()
Load UserForm2
UserForm2.Show
End Sub
' This is the Click event of UserForm2
Private Sub UserForm_Click()
UserForm2.Hide
End Sub

' This is the click event for UserForm1
Private Sub UserForm_Click()
UserForm2.Show
End Sub
************

Don @ SureFireSolutions

P.S. I've got my original problem resolved and working fine by using your
suggestion of Forms!frmMyFormName.Visible = false, etc. but I'm continuing
with my now life long journey of learning more about Access.
 
W

Wayne Morgan

The syntax you've displayed is VB, not VBA in Access. My previous posts
included the examples for Access.
 
W

Wayne Morgan

PS.

The main difference between VB and VBA is that VBA has to be used in
conjunction with the object model for the application (in this case, Access)
that you are using the VBA in. The code you listed is for VB forms, not
Access forms.
 
Top