R
Rob Parker
I must be suffering from old-timers disease today - just can't get this to
work!
I'm trying to set the default value for a textbox control on a subform, from
code run in a different subform on the same main form. The subforms are on
different tab pages on the mainform, but that shouldn't have any influence
on my problem (I'm pretty sure of that). I keep getting RTE 2455 "You
entered an expression that has an invalid reference to the property
Form/Report" at the following line in the Current event of the active
subform:
Me.Parent!sbfrmActionComments.Form!txtActionID.DefaultValue = ActionID
I've tried several other variants, all of which fail in exactly the same
fashion:
Me.Parent.sbfrmActionComments.Form.txtActionID.DefaultValue = ActionID
Me.Parent.sbfrmActionComments.Form!txtActionID.DefaultValue = ActionID
Me.Parent.Form.sbfrmActionComments.Form!txtActionID.DefaultValue =
ActionID
Forms!frmArising!sbfrmActionComments.Form!txtActionID.DefaultValue =
ActionID
Forms("frmArising").Form.sbfrmActionComments.Form!txtActionID.DefaultValue
= ActionID
sbfrmActionComments is the name of the subform control for the second
subform on the main form. The parent form is frmArising, and the code is in
a subform in a control named sbfrmAction.
I know this can be done - in fact, I'm sure I've done it before, just can't
remember exactly where to go check the syntax ;-)
TIA,
Rob
work!
I'm trying to set the default value for a textbox control on a subform, from
code run in a different subform on the same main form. The subforms are on
different tab pages on the mainform, but that shouldn't have any influence
on my problem (I'm pretty sure of that). I keep getting RTE 2455 "You
entered an expression that has an invalid reference to the property
Form/Report" at the following line in the Current event of the active
subform:
Me.Parent!sbfrmActionComments.Form!txtActionID.DefaultValue = ActionID
I've tried several other variants, all of which fail in exactly the same
fashion:
Me.Parent.sbfrmActionComments.Form.txtActionID.DefaultValue = ActionID
Me.Parent.sbfrmActionComments.Form!txtActionID.DefaultValue = ActionID
Me.Parent.Form.sbfrmActionComments.Form!txtActionID.DefaultValue =
ActionID
Forms!frmArising!sbfrmActionComments.Form!txtActionID.DefaultValue =
ActionID
Forms("frmArising").Form.sbfrmActionComments.Form!txtActionID.DefaultValue
= ActionID
sbfrmActionComments is the name of the subform control for the second
subform on the main form. The parent form is frmArising, and the code is in
a subform in a control named sbfrmAction.
I know this can be done - in fact, I'm sure I've done it before, just can't
remember exactly where to go check the syntax ;-)
TIA,
Rob