Solved Forms/Sub Forms

Teri Bridges

Member
Local time
Today, 04:11
Joined
Feb 21, 2022
Messages
187
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.
 
just hide it, add Code to the Mainform's Load Event:

Private sub Form_Load()
Me!subformName.Form.Visible = False
End Sub
 
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
 
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.
 
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!
 
@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

Back
Top Bottom