Karin
Karin

Reputation: 27

How to get a subform field value?

I have an Access form with (continuous) subform and one of the combobox fields on the subform is populated with data depending on the value of another field. For this I use the following in the Data Row Source:

    SELECT VendorName FROM VendorsPerAction WHERE (Action= Forms![LocalSubformActions]![fldAction]) UNION SELECT distinct null FROM VendorsPerAction ORDER BY VendorName;

This works fine when I test the form outside the mainform. But when I test this as part of the mainform Access keeps asking me for the parameter. I tried changing it into:

    (Action= Forms![LocalRequest].[LocalSubformActions]![fldAction])

and many other variations but I keep getting the parameter question.

Is there anyone who knows what I should use? Thank you!

Upvotes: 2

Views: 17929

Answers (1)

Andre
Andre

Reputation: 27634

Probably

Forms![LocalRequest].[LocalSubformActions].Form![fldAction]

(assuming the subform control has the same name as the subform)

See Refer to Form and Subform properties and controls

--> Forms!Mainform!Subform1.Form!ControlName

Upvotes: 4

Related Questions