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

Combo question 1

Status
Not open for further replies.

fkwong

Programmer
Jul 5, 2002
65
US
I have combo box that has two columns, e.g.

1 APPLE
2 ORANGE
3 WATERMELON

When the user select "2", the Combo field saves "2", but I need the 'ORANGE' to store into other field.

How can I accomplish that?

Thanks in advance.

 
Sorry I did not make it clearer, I need '2' to store in field1 and 'ORANGE' store in field2.

Please advice.
 
fkwong

No, maybe I was the one not clear enough, by setting the two properties as mentioned above, the returned value of the combobox will be the value in column 2, which is what you want as far as I can see. Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first or check this link
 
Hi
In the last focus event of the Combo1..

You can code..

ThisForm.myvar1 = This.Value
myVar1 = This.Value
IF myVar1 = This.Value
ThisForm.myVar2 = "Apple
ENDIF
IF myVar1 = This.Value
ThisForm.myVar2 = "Orrange"
ENDIF
...
etc..
and then use it to populate your field..

If you are using an SQL select for the combo.. Then..
using the CursorName.. and the field names you can also easily get all the row items values.

:) ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
Mike,

We almost got it. What I need is as follow:

(1) Field1 (that has the combo box with two columns, eg "1","APPLE"...)

(2) At Field1, when the user select "1" from the combo, the value "1" will be store in Field1 (that is the default), but I also need to store "APPLE" in different field in the table, e.g. field2.

Thanks in advance.

 
fkwong

If you do as I suggested, the Value property of the combobox will be "apple" and the displayValue will be "1", you get both values:
So in the Valid use something like:
SELECT myTable
go bottom
append blank
replace field1 with this.displayValue
replace field2 with this.value

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first or check this link
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top