R
Roger Withnell
I'm inserting a new record into an MS SQL database table
and I want to obtain the new records autonumber
immediately afterwards, as follows:
MadminRS.CursorLocation = adUseServer
MadminRS.CursorType = adOpenKeyset
MadminRS.LockType = adLockOptimistic
MadminRS.Open "NavBar", objConn, , , adCmdTable
MadminRS.AddNew
MadminRS("Url") = Request.Form("Website")
MadminRS("ParentRecNo") = 0
MadminRS("Menu") = "NavBar"
MadminRS("Sequence") = 1000
MadminRS("ButtonName") = "Master Admin"
MadminRS("Link") = "Menu"
MadminRS("Cos") = "Admin"
MadminRS.Update
vRecNo = MadminRS("RecNo") 'the autonumber field
The record is inserted in the table and the autonumber
field is created. vRecNo is blank, however. What is
wrong with this code? I have to obtain the record number
before closing the recordset because I may not be able to
locate the record subsequently.
and I want to obtain the new records autonumber
immediately afterwards, as follows:
MadminRS.CursorLocation = adUseServer
MadminRS.CursorType = adOpenKeyset
MadminRS.LockType = adLockOptimistic
MadminRS.Open "NavBar", objConn, , , adCmdTable
MadminRS.AddNew
MadminRS("Url") = Request.Form("Website")
MadminRS("ParentRecNo") = 0
MadminRS("Menu") = "NavBar"
MadminRS("Sequence") = 1000
MadminRS("ButtonName") = "Master Admin"
MadminRS("Link") = "Menu"
MadminRS("Cos") = "Admin"
MadminRS.Update
vRecNo = MadminRS("RecNo") 'the autonumber field
The record is inserted in the table and the autonumber
field is created. vRecNo is blank, however. What is
wrong with this code? I have to obtain the record number
before closing the recordset because I may not be able to
locate the record subsequently.