MSAccess update
plz help how to update a MS Access DB through recordset with values from text boxes using JET.OLEDB.4.0 database engine.
[120 byte] By [
mahajan7] at [2007-11-20 11:42:30]

# 1 Re: MSAccess update
So, you want us to do everything :confused:
Please show us what code you have written thus far, and what precisely you are struggling with.
# 2 Re: MSAccess update
thanks Hannes for interest.
I have created a recordset having single row & loaded its values in text boxes. When i change some values & click save, i want to update the original database.
Dim cn as New ADODB.Connection, rs As New ADODB.Recordset
With cn
.ConnectionString= "Provider=Microsoft.Jet.OLEDB.4.0;Database = Data.mdb;........"
.CursorLocation = adUseClient
.Open
End With
With rs
.Open "SELECT * FROM ratelist WHERE code='H01'",cn, adOpenDynamic, adLockBatchOptimistic
TextBox1.Text = rs!field1
TextBox1.Text = rs!field2
.................
It works well & displays values in text boxes.
When I change a value in textbox, & click Save command, I want to update the original database Data.mdb.
pls guide.
# 3 Re: MSAccess update
Have you tried something like this?
With rs
rs!field1= TextBox1.Text
rs!field2=TextBox2.Text
.Open "UPDATE * FROM ratelist WHERE code='H01'",cn, adOpenDynamic, adLockBatchOptimistic
end with