what is the difference in the way these work:
Sql = "INSERT INTO mytable (datapath, analysistime,reporttime, lastcalib,analystname,reportname,batchstate,instrument) " & _
"VALUES (dpath, atime, rtime,lcalib,aname,rname,bstate,instrument) SELECT SCOPE_IDENTITY()"
Set rs = cn.Execute
Set rs = rs.NextRecordset
and this:
With rs
.AddNew ' create a new record
' add values to each field in the record
.Fields("datapath") = dpath
.Fields("analysistime") = atime
.Fields("reporttime") = rtime
.Fields("lastcalib") = lcalib
.Fields("analystname") = aname
.Fields("reportname") = rname
.Fields("batchstate") = bstate
.Fields("instrument") = instrument
.Update ' stores the new record
id=fields.Fields("rowid") ' ** Answer to Question ***
End With
my question is specifically this:
i am in a multiuser environment. immediately after the user adds a record, i need to catch the ROWID of the record added. how do i do this?
this is how i open the recordset:
rs.Open "batchinfo", cn, adOpenKeyset, adLockOptimistic, adCmdTable