Subform dependent combo box

  • Thread starter Thread starter Fox
  • Start date Start date
F

Fox

Hi
I was wondering if anyone could help me with a combo box on a sub form

I have a form products that has a subform SuppliesUsed on the supplies used
subform I have a dependent combo box that looks up a value based on another
field.
The following rowsource works perfectly if I open the subform without the
main products form but not when the products main form is opened.

SELECT UnitPriceqry.[Unit Price]
FROM UnitPriceqry
WHERE (((UnitPriceqry.Supply)=[Forms]![SuppliesUsed]![SupplyCombo]));

how do I write the sql so that it knows that the form suppliesUsed is a
subform of the form Products?

Thanks,
 
Forms!Products!subformcontrolname.Form!SupplyCombo

Note that I put "subformcontrolname" in there. Depending on how you added
the SuppliesUsed form as a subform on the Products form, the name of the
subform control on the Products form may be something different than
SuppliesUsed. I'd try using Forms!Products!SuppliesUsed.Form!SupplyCombo
first, and if that doesn't work, you'll have to determine the name of the
subform control and use that.
 
From a main form, you refer to a subform like:

Forms!MainFormName!SubformControlName.Form!SupplyCombo

where SupplyCombo is the name of your combo box.
 
Thanks for your help!
--
Foxy


Arvin Meyer said:
From a main form, you refer to a subform like:

Forms!MainFormName!SubformControlName.Form!SupplyCombo

where SupplyCombo is the name of your combo box.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


Fox said:
Hi
I was wondering if anyone could help me with a combo box on a sub form

I have a form products that has a subform SuppliesUsed on the supplies
used
subform I have a dependent combo box that looks up a value based on
another
field.
The following rowsource works perfectly if I open the subform without the
main products form but not when the products main form is opened.

SELECT UnitPriceqry.[Unit Price]
FROM UnitPriceqry
WHERE (((UnitPriceqry.Supply)=[Forms]![SuppliesUsed]![SupplyCombo]));

how do I write the sql so that it knows that the form suppliesUsed is a
subform of the form Products?

Thanks,
 
Hey thanks for taking the time to help me on what must seem easy. I sure
apprieciate it!
--
Foxy


Douglas J. Steele said:
Forms!Products!subformcontrolname.Form!SupplyCombo

Note that I put "subformcontrolname" in there. Depending on how you added
the SuppliesUsed form as a subform on the Products form, the name of the
subform control on the Products form may be something different than
SuppliesUsed. I'd try using Forms!Products!SuppliesUsed.Form!SupplyCombo
first, and if that doesn't work, you'll have to determine the name of the
subform control and use that.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Fox said:
Hi
I was wondering if anyone could help me with a combo box on a sub form

I have a form products that has a subform SuppliesUsed on the supplies
used
subform I have a dependent combo box that looks up a value based on
another
field.
The following rowsource works perfectly if I open the subform without the
main products form but not when the products main form is opened.

SELECT UnitPriceqry.[Unit Price]
FROM UnitPriceqry
WHERE (((UnitPriceqry.Supply)=[Forms]![SuppliesUsed]![SupplyCombo]));

how do I write the sql so that it knows that the form suppliesUsed is a
subform of the form Products?

Thanks,
 
Back
Top