I am having controlling the master form from a subform. The subform will be used across several master forms, so it is important for the master form to have a variable name. I've successfully figured out how to set the textbox txtMasterFormName in the subform to the appropriate value. I'd like to use the value in the textbox to reference the master form, and make another subform visible.
Code:
Private Sub Label10_Click()
Dim MasterFormName As String
'For example, let's say txtMasterFormName = frm05LoginLandingPage. That is an existing form that is spelled correctly
MasterFormName = Me.txtMasterFormName.Value
Forms(MasterFormName).SetFocus
Forms!MasterFormName!frm071UploadPopUp.Forms.Visible = True
'Intended output should be Forms!frm05LoginLandingPage!frm071UploadPopUp.Forms.Visible = True
End Sub
I am getting the error "Microsoft Access cannot find the referenced form 'MasterFormName'"
Any help?