Dim cnxn As ADODB.Connection
Dim rs As ADODB.Recordset
Set cnxn = CurrentProject.Connection
Set rs = New ADODB.Recordset
With rs
.Open "temp", cnxn, adOpenKeyset, adLockOptimistic, adCmdTableDirect
.AddNew
.Fields("txt") = "test"
.Update
.Close
End With
Set rs = Nothing
However, are you sure you don't want to just write:
Dim cnxn As ADODB.Connection
Set cnxn = CurrentProject.Connection
cnxn.Execute "INSERT INTO temp (txt) VALUES ('test')"
Darryl Kerkeslager
<ka*****@humsay.com> wrote:
I want to avoid INSERT INTO command. This command creates too hassle
for proper syntax.
How can I use
set rs = Server.CreateObject("ADODB.recordset")
rs.Open("temp", "", LockType.Optimistic)
rs.AddNew
rs.Fields("txt") = "test"
rs.Update
rs.Close
This code is not working. Also how can this be used to update a record.