Access 2010: Selected record value from subform

user3302702 picture user3302702 · Feb 12, 2014 · Viewed 22.7k times · Source

Thank you in advance for the help for this problem - it has been driving me mad.

First of all: My question is regarding the how-to here: http://www.fmsinc.com/MicrosoftAccess/Forms/Synchronize/LinkedSubforms.asp.

I have a form in Access 2010 that contains a subform. The content of the subform is updated with VBA. Everything works great here.

I want to be able to open another form based on the record, that the user has chosen in the subform. This entails knowing the number of the record selected by the user. To start with, I just what the ID of the chosen record to be written into a normal textbox in the form.

I found the solution in the above-metioned link. It says:

"To reference a value in a subform, use the following syntax for the text box's Control Source property:

=[subFormName].[Form]![ControlName]"

It works perfectly in their example (I have downloaded the .mdb and it works!), but when I try, the "[Form]" is not an option. And so, I cannot get it to work!

I tried in their .mdb as well, and I cannot chose [Form] either, so as soon as I change the control source property of the textbox, it stops working. I have tried with [.Formula] instead, but nothing (link to screenshot: http://i.imgur.com/pR2WkSW.png?1)

What could be the problem? Maybe language settings?

Thank you so much in advance.

M.

Answer

parakmiakos picture parakmiakos · Feb 13, 2014

I'm not sure how it's different in Access 2010 but as you can see below, for Access 2007 :

referencing a subform control

You can directly refer to a control in the Expression Builder. Just :

a) expand your form name on the left frame

b) select your subform name on the left frame

c1) If you want to refer to a specific control (i.e. a text box) simply select it from the middle frame (double click on it)

c2) If you want to refer to a form property (i.e. the subform's filter) select the tag in the middle frame, and the corresponding property in the right frame

c3) If you want to refer to an item of the subform's recordset, use the tag in the middle frame and select the item from the right frame

It should all be there.