Combobox...selected value not replicated to subform

jakobt

Active Member
Joined
May 31, 2010
Messages
337
I have a form:
I inserted a combobox with a customer Id and client name
I inserted a subform with orders.
The childfield is customerid.orders the master field is costurmerid.costumer.


When I select a customer in the combobox...the orders for the customer is not automatically updated in the subform?

(The form record source is set to customer)
 
Well I wanted to see the fields in your tables in order to suggest the code. Since there are at least 2 ways to relate the main form records with matching subform records and I don't know your fields nor your current structure, I'll point you to 3 video tutorials that explain the 2 methods.

Method 1 --linkMaster and Child fields based on your tables
see

Method 2 --unbound combo on main form, vba code to filter subform records based on the mainform combo and
techniques to clear the subform control values on load and if no selection has been made in the mainform combo.
see
and

Good luck.
 
Upvote 0

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
It's not clear to me if you want to filter the subform or make a field on it equal to a value that you select in the main form combo. Regardless, the subform reference syntax is Forms!FormNameHere!subFormControlNameHere.Form to refer to the form. After that goes the control name, form property or method that you want to use. So to make control txtMyTextbox = to "cat" for example, it would be
Forms!FormNameHere!subFormControlNameHere.Form.txtMyTextbox = "cat"

NOTE that subFormControlNameHere is the name of your subform control that contains your subform.
 
Upvote 0

Forum statistics

Threads
1,214,864
Messages
6,121,986
Members
449,058
Latest member
oculus

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