I would like to hide and unhide a subform with the click of a command button. Can I create command button thru a wizard and change the code to do this?
me.hide.subform name
Private Sub CmdHide_Click()
Forms!XXXXX!TrialCadetAdd.Visible = False
End Sub
MainForm XXXXX
SubForm TrialCadetAdd
I get an error stating that It could not find the expression
Trial Cadet Add
I changed the subform name as a form from Trial Cadet Add
to TrialCadetAdd
I want to hide my subform until the user clicks the button
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
Over the 23 years posting here, I have answered many access problems. I don't do it now as I'm retired and well into my 70's, I'm afraid the memory is failing, along with eyesight, hip joints and heart. Probably within 5 years I'll not be posting at all, unless they have WiFi in hell.
Col
When you are referring to an object of the current form, use "Me." When you are referring to a separate form, then use the long form reference method. It clarifies what you are doing and uses the shortest code string possible.
So, from a button on the main form to hide a subform, use:
Me.sfrmMySubformName.Visible = False