Private Sub Form_Load()
combo1.AddItem "x"
combo1.AddItem "y"
combo1.AddItem "z"
End Sub

Private Sub cmdGetIndex_Click()
If combo1.Text = "x" Then
txtdel.Text = "x"
End If
If combo1.Text = "y" Then
txtdel.Text = "y"
End If
If combo1.Text = "z" Then
txtdel.Text = "z"
End If
End Sub

your codes are ok buh much and redundant
maybe this should be much better
******************************************************************************************

private sub cmdGetIndex_click()
if combo1.text="x" then
txtdel.text="X"
elseif conbo1.text="y" then
txtdel.text="y"
else
txtdel.text="z"
end if
end sub

******************************************************************************************
buh I will like to see your databse connection code

Why don't you just add the text to the textbox txtdel when a user selects a value in combo box?

''In combo click event...

txtdel.Text = cmbCombo.Text ''Assuming thats what your combobox is called...

Now make the connection to database, open recordset, get the value and save it

''Database connection here...
''Open recordset here..

rs.AddNew

rs!MyField1 = txtdel.Text

rs.Update

rs.Close

iam trying to enter the combo.text through insert statement Is it possible to enter to enter the combobox entry through insert statement ?

This article has been dead for over six months. Start a new discussion instead.