Solved Forms/Sub Forms (1 Viewer)

Teri Bridges

Member
Local time
Yesterday, 19:04
Joined
Feb 21, 2022
Messages
186
Guys, with help from this form I was able to get my show/hide sub form button working.

Now I am wondering if it is possible to have the sub form in the closed state when the main form loads? So the user does not see it unless they want to.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 08:04
Joined
May 7, 2009
Messages
19,169
just hide it, add Code to the Mainform's Load Event:

Private sub Form_Load()
Me!subformName.Form.Visible = False
End Sub
 

Teri Bridges

Member
Local time
Yesterday, 19:04
Joined
Feb 21, 2022
Messages
186
As you can surly tell I am new to coding. I have already entered an on load code and am not sure how to add this to it properly
Here is what I currently have:
Private Sub Form_Load()
DoCmd.GoToRecord , , acNewRec
End Sub
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 08:04
Joined
May 7, 2009
Messages
19,169
add it to your code:

Private Sub Form_Load()
DoCmd.GoToRecord , , acNewRec
Me!SubformName.Form.Visible = False
End Sub

//Edit: you can interchange it's Code position, doesn't matter since the Form/Subform is not visible yet on the Load event.
 

Teri Bridges

Member
Local time
Yesterday, 19:04
Joined
Feb 21, 2022
Messages
186
add it to your code:

Private Sub Form_Load()
DoCmd.GoToRecord , , acNewRec
Me!SubformName.Form.Visible = False
End Sub

//Edit: you can interchange it's Code position, doesn't matter since the Form/Subform is not visible yet on the Load event.
So it reads each line separately I do not need if then statements. You are a huge help thank you. This is a great forum!
Worked perfectly!
 

Gasman

Enthusiastic Amateur
Local time
Today, 00:04
Joined
Sep 21, 2011
Messages
14,048
@Teri Bridges You might want to watch a few Youtube videos by Steve Bishop. That should give you a good starter, if you were not aware of the above.
So it reads each line separately I do not need if then statements. You are a huge help thank you. This is a great forum!
Worked perfectly!
 

Users who are viewing this thread

Top Bottom