Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filtering a combo box with another combo box...

Status
Not open for further replies.

Datathumper

Technical User
Jan 26, 2004
46
CA
Here is the issue.

I have a subform on a form with two combo boxes. The first box (drawing), should filter the second combo box (weld) when a value is selected. In order to refresh the second box value when the first is selected, I used afterupdate..me.weld.requery.

This works until I get to the second record and try the same filtering. Once a drawing is selected, it wipes out the weld values of the previous records in the current form. Any suggestions on how I may be messing up?

Thanks in advance.
 
Comboboxes all show the same data in a continuous form from record to record. What you can do here is create two bound textboxes. These textboxes are bound to the two fields in your table for this subform. Now create your comboboxes as unbound controls. Make them slightly larger than the textboxes so that just the dropdown arrow on the right shows to the right of the textbox control You want to put the textbox control on top of the combobox control They will look like the same conrol and will take on the look of the combobox. Now in the AfterUpdate of the combobox control assign the selection made to the textbox control:

Code:
Me.[Textbox1ControlName] = Me![ComboBoxName1]
Me.[ComboBoxName2].requery
Me.[ComboBoxName2].setfocus
Me.[ComboBoxName2].dropdown

Set the second combobox and textbox controls up the same way. Textbox on top of the Combobox with just the DownArrow box on the right showing. The following code then in put in the Afterupdate of the second combobox:

Code:
Me.[Textbox2ControlName] = Me![ComboBoxName2]
Me.[ComboBoxName1] = Null
Me.[ComboBoxName2] = Null

Both TextBoxes should have their Locked property set to Yes and their TabStop set to No. This keeps the actual textbox from being modified by keystrokes and a pick from the combobox is the only way to update it.

Post back if this is confusing. It is a tricky visual thing that we are doing here and if done correctly your user won't know that you have four different controls working this situation.

[COLOR=006633]Bob Scriver[/color]
MIState1.gif
[COLOR=white 006633]MSU Spartan[/color]
 
How are ya Datathumper . . . .

[blue]scriverb[/blue] is right on Q.

Another option is to bound the CBs to the specific fields with [blue]LookUp Tables[/blue] that include all data which you filter as necessary.

Flag0.gif
Remember Our Veterans! Remember Sept 11th!
 
scriverb...your a genius!!

This sounds just like what I need, although I think that I will only require it on the second combo and not the first.

I am going to give this a shot and get back to you on the results.

Thanks bunches for the help with this one.

Datathumper
 
Thanks for the kudos but let's wait until we get it working for you. Post back with any questions or problems that you encounter. This technique does work as I have set this up before with success.

[COLOR=006633]Bob Scriver[/color]
MIState1.gif
[COLOR=white 006633]MSU Spartan[/color]
 
scriverb

It works like an absolute charm! You cannot even tell that there is a combo box hidden behind the text box!

Thanks a million for the tip, I can now get on with my life as that little problem was haunting me for the past couple of days.

Datathumper
 
Outstanding!! Glad to be of help to you.

[2thumbsup]

[COLOR=006633]Bob Scriver[/color]
MIState1.gif
[COLOR=white 006633]MSU Spartan[/color]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top