Add record receives error message (resolved)
Hi,
Can anyone tell me why I kept getting this error message. I am trying to add a record into the database "test.mdb" and a table "table1".
ID | One | Two | Three | Four | Five | Six | Seven |
--------------------------------------------------
01 | 101 | 202 | 3003 | 404 | 505 | 66 | 71117 |
02 | 111 | 212 | 3113 | 414 | 515 | 66 | 72227 |
Thanks,
Phillip
"Run-time error '3251':"
"Current Recordset does not support updating. This may be a limitation of the provider, or of the selected locktype."
Code:
Private Sub Command6_Click()
Dim con As Adodb.Connection
Dim rs As Adodb.Recordset
Set con = New Adodb.Connection
con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & InputFileName & ";"
con.Open
Set rs = con.Execute("SELECT One, Two, Three, Four, Five, Six, Seven FROM Table1")
With rs
.AddNew
.Fields("One") = Text1(13).Text
.Fields("Two") = Text1(12).Text
.Fields("Three") = Text1(11).Text
.Fields("Four") = Text1(10).Text
.Fields("Five") = Text1(9).Text
.Fields("Six") = Text1(8).Text
.Fields("Seven") = Text1(7).Text
.Update
.Close
End With
End Sub