2 tables, 1 Combo box

bobzarkoff

New Member
Joined
Jun 20, 2008
Messages
33
I have a field in a form that can either be a number from table A, a number from table b or just "Standard". I've tried to get the combo box to do this but at the moment it's eluding me. Basically I want 1 list that's made up from 2 separate tables. Any ideas other than creating a third table?
 

Some videos you may like

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

SydneyGeek

MrExcel MVP
Joined
Aug 5, 2003
Messages
12,251
How will you know which table the number came from? Or isn't that important?

Denis
 

bobzarkoff

New Member
Joined
Jun 20, 2008
Messages
33
Each number has a unique style so you can tell what type it is by looking at it. Basically it's for an order form, the order can either be ordering stock (standard) or from a customer making a request or from a project that is being worked on. When the order comes in they need to be able to tell what it was for.
 

SydneyGeek

MrExcel MVP
Joined
Aug 5, 2003
Messages
12,251
My preference in that case is to create different subforms for the separate scenarios, then load the appropriate subform as required. The reason for that is that each option may have different fields, and trying to hide/display the correct fields at run time is not always foolproof.

Option 1: Have all subforms on the main form, toggle visibility
You build each subform with the required fields. Set each one to be exactly the same size, then layer them on top of each other.
When the user selects what they will be doing (Combo box with list options like Order Stock, Customer Request, Existing Project), you set the visibility of the desired form to Yes and the others to No.

Option 2: Load a blank form.
Again, user selects from the combo. At this point you change the Source Form for the blank to whichever form is required.

Option 1 is easier to set up. Option 2 gives better performance.

If instead you want to go with the one subform, combo pulling data from two or more tables, you can use a Union query as the row source for the combo.

Denis
 

Bill Rockenbach

Well-known Member
Joined
May 4, 2009
Messages
1,412
A third option:
Provide a combo box to select one of the three options Order Stock, Customer Request, Existing Project.

Assign a defined name to each of the three number tables.

On selecting the type of option have the Combox change procedure write the associated table defined name to the RowSource property of the combobox to select a number.
 

bobzarkoff

New Member
Joined
Jun 20, 2008
Messages
33
Thank guys, figured it out with option buttons instead of the first combo box and then using mouse down on each option to generate row source property.
 

Watch MrExcel Video

Forum statistics

Threads
1,127,942
Messages
5,627,744
Members
416,272
Latest member
ndiaz2

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
Top