Using a combo as the recordsource for a subform

davidcantor
3StarLounger
Posts: 247
Joined: 05 Nov 2012, 19:40

Using a combo as the recordsource for a subform

Post by davidcantor »

I have a form with a subform when the main form opens the subform is set to not visible. when a selection is made from a combo box i want the selection to be the recordsourse for the subform

I have a variable vSelected and have assigned the sql for the recordsource to it with the cmbo box as the criteria
then I have the code to assign the string as the Recordsource of the subform.

with this line

Code: Select all

Forms!Form1!sfExpense.RecordSource = vSelected
when I run the code I get an error message: Run time error '438' Object doesn't support this property or method

User avatar
HansV
Administrator
Posts: 78629
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Uisng a combo as the recordsource for a subform

Post by HansV »

You have to specify explicitly that the recordsource is a property of the Form object in the subform control:

Forms!Form1!sfExpense.Form.RecordSource = vSelected
Best wishes,
Hans