Form- combo box selection to update form it's embedded in

davin2929

Board Regular
Joined
Oct 13, 2002
Messages
129
I've done a search but can't find anything to help me out. how do i update a form from a combo box selection that is located on the form? for instance i have two criteria 1)client number 2)issue number (there many issues per client). i created a combo box to list related issues for the client that is shown on the form. this works great. problem is i want to select another issue from the combo box and have it update the form to show that issue. the form and combo box are pulling information from one main table. any help would be great. i've spent the better part of the afternoon finding a wall to bang my head against.
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
general description

Forms, when they are first opened, attempt to load everything.
There's a couple different approaches depending on your needs.

One I prefer is this.

Start by creating a form with a combo-box. The recordsource for the combo-box is a query that returns a list from a single field in a Source Table (displays a single name, but holds 2 or more actual fields...including one field that is the unique identifying key for the records)

On the After_Update event for the Combo_box, you put code that:

1) Sets a subform (embedded in the mainform) to visible
2) Sets the recordsource for the subform to a SQL query that extracts only items that match the keyfield (above after you selected it in the cbo)
3) Requeries the subform (requery is mandatory if you wish to allow the user to select an item, then select a second, third, fourth, etc -- AND expect the subform to change the displayed information)

For the subform - pick how you wish to display it. Most of the time, you don't want it as a datasheet but your application may be different.

Mike
 
Upvote 0

Forum statistics

Threads
1,221,877
Messages
6,162,583
Members
451,776
Latest member
bosvinn

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