G
Guest
I am having trouble with the correct syntax to refer to a control on a subform.
I created a toggle button on my main form (frmChrgBackLog) to show or hide a
column in my subform (subfrmChrgBackLog). The subform object name in the
main form is the same as the subform name. I tried multiple versions of code
to do this but neither of them have worked. The code will be in the main
form. Is this possible and if so what is wrong with my syntax? Thanks,
'Version 1
Me.subfrmChrgBackLog.Form!jobnumlong.Visible = _
Not Me.subfrmChrgBackLog.Form!jobnumlong.Visible
'Version 2
Me.subfrmChrgBackLog.Form.Controls("jobnumlong").Visible = _
Not Me.subfrmChrgBackLog.Form.Controls("jobnumlong").Visible
'Version 3
Forms!frmChrgBackLog!subfrmChrgBackLog.Form!jobnumlong.Visible = _
Not Forms!frmChrgBackLog!subfrmChrgBackLog.Form!jobnumlong.Visible
I created a toggle button on my main form (frmChrgBackLog) to show or hide a
column in my subform (subfrmChrgBackLog). The subform object name in the
main form is the same as the subform name. I tried multiple versions of code
to do this but neither of them have worked. The code will be in the main
form. Is this possible and if so what is wrong with my syntax? Thanks,
'Version 1
Me.subfrmChrgBackLog.Form!jobnumlong.Visible = _
Not Me.subfrmChrgBackLog.Form!jobnumlong.Visible
'Version 2
Me.subfrmChrgBackLog.Form.Controls("jobnumlong").Visible = _
Not Me.subfrmChrgBackLog.Form.Controls("jobnumlong").Visible
'Version 3
Forms!frmChrgBackLog!subfrmChrgBackLog.Form!jobnumlong.Visible = _
Not Forms!frmChrgBackLog!subfrmChrgBackLog.Form!jobnumlong.Visible