i having trouble determining why examples below behaving way are.
works:
debug.print forms!form1![subform1]!control1 doesn't work:
debug.print forms!form1![subform1].control1 with error:
run-time error '438':
object doesn't support property or method
@ first glance assume .control1 accessing property of subform1 instead of control makes sense why there error.
yet reasoning doesn't seem apply when using these examples:
debug.print forms!form1![subform1].form.control1 debug.print forms!form1!subform1.form.control1
screenshots of results:

to me these examples accessing .chat_message_id property of chat's form object, yet no error message , work fine.
why these 2 examples work yet debug.print forms!form1![subform1].control1 doesn't?
in many situations, access form object lets access controls , record source fields if properties of form. means can employ intellisense when you're editing vba code within form, can refer value of control named control1 me.control1 or me.control1.value
that feature why debug.print forms!form1!subform1.form.control1 can work. debug.print forms!form1!subform1.control1 fails because subform1 control, not form object, , not include property named control1. (that error message complains about.)
the situation can more complicated if subform's sourceobject table or query instead of actual form object. haven't worked through details variations myself, suggest them if want use subformcontrol.form.property pattern.
i use forms!form1!subform1!control1, less confusing me.
Comments
Post a Comment