crossfire04
asked on
MSAccess Coding - How to get record ID of record just inserted
I have a function that I pass a record id to, this function copies the field values into a new record and does an insert. I need to capture the new record's ID. Can you help?
Function addnewrecord(testcasenbr)
Dim db As DAO.Database
Dim sSQL As String
Dim rst
Set db = DBEngine(0)(0)
sSQL = " INSERT into tbl_Testcases " & "(tc_Name, tc_Desc) " & "SELECT tc_Name, tc_Desc " & _
"FROM tbl_Testcases " & " WHERE tc_Id = " & testcasenbr & ";"
db.Execute sSQL, dbFailOnError
db.Close
End Function
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.