I have a VB 6 program that contains a form with a data control and a combo box. The combo box contains numbers 1-10, and the data control is linked to an Access table that contains fields Name, and 1-10. I want to press a button on the form, and have a value written to the proper field based on the value in the combo box. So If the users choose 5 in the combo box, I want the data to be written to field 5 in my table. I can code it the really long way:
if cboWeek.Text = "1" then
data1.recordset![1] = text1.text
elseif cboWeek.Text = "2" then
data1.recordset![2] = text1.text
so on
but I have to do something like this multiple times in my program.
There must be a way to say something like: data1.recordset[cboWeek.Text], but I am not sure of the syntax.
Please help!
>> Stay informed about: Combo Box and Recordset Help