MY code doesnt saves the data entered through dropdown box into access database

Recommended Answers

All 8 Replies

please show us your code

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

now what code you have for database connectivity

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

Inline Code Example Here

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 ?

yes , you can use insert statement for inserting data to database

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.