Force text into field in table from combo box

S

Secret Squirrel

This may be simple but for some reason I can't think straight right now.
I have a form that is bound to my tblAttendance. I have a combo box on my
form that has a control source in my tblAttendance. What I want to do is
write column(2) from my combo box to a text field in my table. I know I can
have it display on my form using = type.column(2) but how do I write it to my
table?
 
L

Larry Linson

Secret Squirrel said:
I have a form that is bound to my tblAttendance. I have
a combo box on my form that has a control source in my
tblAttendance. What I want to do is write column(2) from
my combo box to a text field in my table. I know I can
have it display on my form using = type.column(2) but
how do I write it to my table?

A simple way that will also display the value to the user is to create
another Text Box on the Form, with Control Source of the Text Field, for
illustration call the Text Box "txtMyText" and the Field "MyText", where you
wish to save the. In the AfterUpdate event of the Combo, call it
cboMyCombo,

Me.txtMyField = Me.cboMyCombo.Column(2)

but remember, used in code, the columns begin with 0, so the first column
(visible or not) is 0, the second is 1, and the third is 2. If you are
having difficulties, that might be the cause, if you didn't remember.

Larry Linson
Microsoft Office Access MVP
 
Top