Requery subform field when another subform field changes

cgclower

New Member
Joined
Feb 28, 2010
Messages
40
Hello!

I have a form (called, let's say, MyFormName) that has 3 combo boxes on it. The user selects a value from a list in the first combo box, and then I use this code -
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p></o:p>
Code:
Me.SecondComboBox.Requery
<o:p></o:p>
- and a SELECT statement to have the second combo box show a list of values based on what was in the first combo box. Then the user picks a value from the second box, and similar code makes the third combo box show values based on what the second one has.
<o:p></o:p>
This form works perfectly on its own as a pop-up, but when I put it in another form as a subform the requery does not work right. After making a selection in the first combo box, Access asks for a value ("Enter a Parameter Value: Forms!MyFormName!FirstComboBox") for the first box when it tries to run the code above.
<o:p></o:p>
Assuming the description of my problem makes sense, does anyone know why this is happening? And how I can fix it? I was thinking that changing
Code:
Me.SecondComboBox.Requery
to
Code:
[Forms]![MyFormName].SecondComboBox.Requery
would work, but it did not.

I can find lots of solutions for requerying the subform when something on the Parent form changes and vice versa, but nothing about requerying a field on the subform when something on the subform changes.
<o:p></o:p>
Thanks for the help!
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Possibly:
Code:
[Forms]![MainForm].Controls("SubFormControlName").Form.SecondComboBox.Requery

(a subform is technically a control that belongs to the main form. It has a form property, which gives you access to the subform itself).

Why are you burying cascading comboboxes in a subform anyway? Put them on the main form.
 
Upvote 0

Forum statistics

Threads
1,214,614
Messages
6,120,519
Members
448,968
Latest member
Ajax40

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top