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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

default values for combo box 3

Status
Not open for further replies.

ocan1

Programmer
May 6, 2005
11
US
I have a combo box on a form that is based off of a query based off of the selection of another combo box. The selection in the combo box needs to always be the first line item in the combo box. Is there anyway this 1st row can always come up after the selection in the other combo box. I am having no luck with the ItemData(0)Default method.

I'd appreciate any help. Thanks.
 
I think that would work if I needed the combo box to default when the form is loaded, but I actually need the combo box to default to the 1st selection after the selection of another combo box. Since the correct selection of the 2nd combo box will always be the 1st row, I am just trying to avoid having to manually select it.
 
I didn't "bother" mentioning events, since it's been mentioned several times through this thread, among others, in the reply just above mine "Combo0_AfterUpDate()" - i e - in the after update event of the control which is also providing the criteria for populating the combos rowsources.

I'm also getting a bit curious, of the setup, if it will always be the first row of the combo that is the correct selection, why use combos? Why not just a text control?

Roy-Vidar
 
I am not sure if this is the best way to do this, but what I am trying to do is on a subform & continuous form:

Fields:

Test Name Result Lower Spec Upper Spec Typical
(combo1) (txtbox) (combo2) (combo3) (combo4)

The user will Select the test name performed & enter the result and based on the selection of the Test Name, the lower, upper & typical spec will automatically be filled in. The theory behind the combo vs. the text boxes is that they will serve as a lookup(the specs) & store(the specs). Only current specs are in the computer, so I was not using texts as lookup, because if specs change, I don't want previous "test files" to reflect the new specs, yet to store the specs that were current at data entry.

I hope this makes sense.

 
So - none of the provided suggestions work in combo1's after update event, after assigning rowsources to the combos?

Roy-Vidar
 
Roy-Vidar after all the replies, I finally found the one that works perfectly!

The 3rd code: me!cboCombo.value = me!cboCombo.itemdata(0)
on After Update works perfectly.

You don't know much I appreciate your help!

 
Additionally on the same form, the user manually selects each test from the test name combo box. Is there anyway that when the form is loaded the first record(in the continuous form)/combo box would show the 1st row in the combo box, the 2nd record/combo box would show the 2nd row. (There's not always the same amount of tests).
 
Hmmm - using the first row, is kind of dynamic, assigning the second - getting close to hardcoding?

Replace the 0 with 1 in the itemdata thingie.

Roy-Vidar
 
Form Setup:

Test Name Result Lower Spec Upper Spec Typical
(combo1) (txtbox) (combo2) (combo3) (combo4)

I would like to avoid manually selecting the test names. The test names are already in combo1 & i want all the names in the combo box to be selected and they are in order. I am thinking on form load the 1st row would show up in the first combo box(and I understand how to do that now), then when user enters the result for the 1st test, then name of the 2nd test/row shows up & when that result is entered the 3rd test/row shows up and so on. So in the text box if I put in AfterUpdate Replace the 0 with 1 in the itemdata. I understand that would bring up the 2nd row, but then what happens when I enter the 2nd result it will bring up the 2row when I need it to bring up the 3rd test name.

I hope that makes sense.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top