Solved Show Hide sub Form

Teri Bridges

Member
Local time
Yesterday, 19:06
Joined
Feb 21, 2022
Messages
187
I want to show/Hide my sub form. when the user clicks the button the subform displays and when they click again it hides
I cannot get any of these to work
'Hide It
Forms!frmCourseDetails!frmCourseReviewCycleSubform.Visible = False
'Show it
Forms!frmCourseDetails!frmCourseReviewCycleSubform.Visible = True

This does not work either
Private Sub btnOpenReviewCycle_Click()
If Me.frmCourseReviewCycleSubform = False Then

Me.frmCourseReviewCycleSubform = True

ElseIf Me.frmCourseReviewCycleSubform = True Then

Me.frmCourseReviewCycleSubform = False

End Sub
 
maybe try:
Code:
Private Sub btnOpenReviewCycle_Click()
With Me!frmCourseReviewCycleSubform.Form
   .Visible = Not .Visible
End With
End Sub
 
Tried that and get the same error
1651294713928.png

1651294732461.png
 
you bring your main form in design view.
click on the subform in question and see it's Name on the Property window.
substitute the "Real Name" to frmCourseReviewCylemSubform in your code.
 
you bring your main form in design view.
click on the subform in question and see it's Name on the Property window.
substitute the "Real Name" to frmCourseReviewCylemSubform in your code.
Yes I checked that.
1651296848310.png
 
ok, you got it.
but on the snapshot you showed, it is not the Caption i am refering.
if you go to the "Other" tab, and you will see it's Name property.
 
ok, you got it.
but on the snapshot you showed, it is not the Caption i am refering.
if you go to the "Other" tab, and you will see it's Name property.
Humm. I do not see that on the other tab.
1651300160327.png
 
try it again. click anywhere the form but the subform.
now try clicking on the Border of the subform, until a Yellow-Orange line/Box surrounds it.
go and see it's Name on the property sheet.
 
I would have thought you would need to use the name of the subform control? That is the same name as the form when you add the subform, which you have just done?
 
I would have thought you would need to use the name of the subform control? That is the same name as the form when you add the subform, which you have just done?
I had eariler changed the name of the form and thought I had updated it everywhere. But I did not know about the other tab check. I am sure that is why I was getting the code errors. When I deleted the sub form and added it back (New Name) it worked. These are my rookie mistakes.
 
I always prefixed the subform control name with sfrm, so as to be able to distinguish between control and form, once I found this out.
Same with subreport, srpt
 
I always prefixed the subform control name with sfrm, so as to be able to distinguish between control and form, once I found this out.
Same with subreport, srpt
Good Idea. I have been adding subform to the end but using the "s" would shorten things up and make sorted. Thanks.
 

Users who are viewing this thread

Back
Top Bottom