I have two command buttons that I am using to open and close a subform. To open the subform in the main form I am using the code:
Private Sub OpenSubform_Click()
Me![SubformName].Form.Visible = True
End Sub
To close the subform in the main form I am using the code:
Private Sub CloseSubform_Click()
Me![SubformName].Form.Visible = False
End Sub
The command buttons work as I want them to, the problem is that when I open the main form I get a message box saying "Microsoft Access can't find the form 'SubformName' referred to in a macro expression or Visual Basic code." If I click "OK" to get out of this message box, the main form opens and the command buttons work as expected. Does anyone know why the message box is popping up and what I can do to eliminate it?
Thank you!
Private Sub OpenSubform_Click()
Me![SubformName].Form.Visible = True
End Sub
To close the subform in the main form I am using the code:
Private Sub CloseSubform_Click()
Me![SubformName].Form.Visible = False
End Sub
The command buttons work as I want them to, the problem is that when I open the main form I get a message box saying "Microsoft Access can't find the form 'SubformName' referred to in a macro expression or Visual Basic code." If I click "OK" to get out of this message box, the main form opens and the command buttons work as expected. Does anyone know why the message box is popping up and what I can do to eliminate it?
Thank you!