how do use this code properly

genesis

Registered User.
Local time
Yesterday, 21:50
Joined
Jun 11, 2009
Messages
205
me.textbox1.value=me.combox.column(2)

will this code set the value of textbox1 to the value of column 2 of the combox ?

is this proper?
 
1) If the field (combo box) is named "combox",
2) and if this combo box has 3 column (first column is 0).
3) If this code is in sub combo box AfterUpdate.
Tehn it is proper.
 
you dont need the value or the me

textbox1 =combox.column(2) is sufficient

a couple of things

1. as mstef pointed out, combo boxes are zero based, so a reference to column(2) actually gives you the third column in the underlying query.

also
textbox1 =combox.column(0)
textbox1 =combox

are the same thing and pick up the value of the combo box (to be pedantic, this is assuming that the combo box is BOUND to column 1 of the query (normally is, but it doesnt have to be)

2. the column count refers to the underlying query
so combox.column(2) refers to column 3 in the underlying query. The point is that the combo box itself may have several columns set to zero width, so they dont display, They are still there - so you have to refer to the query, not the visible combo box
 

Users who are viewing this thread

Back
Top Bottom