Hoping someone will give me some quick help here. I'm creating a new record in an Access DB with a VB6 app using the following code:
I need to get the Primary key for the newly created record. The Primary key is a field called "Job#" and is a Long Integer, if that helps.
Thanks in advance.
Code:
Set conn = CreateObject("ADODB.Connection")
connString = "PROVIDER=MICROSOFT.JET.OLEDB.4.0; DATA SOURCE=\\Whatever\Generic.mdb; User ID=admin; Password=;"
conn.Open connString
SQL = "Select * From Job"
Set rs = CreateObject("ADODB.Recordset")
rs.LockType = 3
rs.Open SQL, conn
rs.AddNew
rs.Fields("UserID") = fldUID
rs.Fields("Account#") = fldAcct
rs.Fields("Dept#") = fldDept
rs.Fields("VoxSize") = fldVS
rs.Fields("Priority") = fldP
rs.Fields("EndTime") = fldET
rs.Fields("DicTime") = fldDT
rs.Fields("Status") = fldStatus
rs.Update
Set rs = Nothing
Set conn = Nothing
I need to get the Primary key for the newly created record. The Primary key is a field called "Job#" and is a Long Integer, if that helps.
Thanks in advance.