How do I programmatically get the current linked value on a subForm in access. The documented string property subForm.LinkMasterFields throws an error when I try to reference it.
+1
A:
LinkMasterFields will give you the name of the field it's linking on. Try this and see what it says
MsgBox Me.subForm.LinkMasterFields
If you want to get a value from a field on the subform you can get it like this
MsgBox Me.subForm.Form.field_1
or directly with
MsgBox subFormRealName.Form.field_1
''// n.b.: you're running with scissors if you do this - especially if you have
''// the possibility of having the same subForm open multiple times at once
''// e.g., on the same form or on two different forms at once.
CodeSlave
2010-04-21 16:58:39
I would caution against ever using an unspecified reference to controls on a form or report. Thus, I'd say never to use your third suggestion.
David-W-Fenton
2010-04-21 21:12:45
You're absolutely right... answer updated. Thanks.
CodeSlave
2010-04-22 17:07:14
I was looking to retrieve the current linked value on the subform to act on. I eventually worked around this using tabbed pages, using 2 subforms rather than 1 and trying to determine the linked value on it. I am yet to find out if the original technique works though. Thanks
bizl
2010-04-23 09:34:05