Solved Forms/Sub Forms (1 Viewer)

Teri Bridges

Member
Local time
Today, 07:08
Joined
Feb 21, 2022
Messages
53
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, 20:08
Joined
May 7, 2009
Messages
16,823
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
Today, 07:08
Joined
Feb 21, 2022
Messages
53
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, 20:08
Joined
May 7, 2009
Messages
16,823
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
Today, 07:08
Joined
Feb 21, 2022
Messages
53
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, 13:08
Joined
Sep 21, 2011
Messages
10,853
@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