capture autonumber in mysql with .addnew

icemonster

Registered User.
Local time
Today, 08:07
Joined
Jan 30, 2010
Messages
502
so this code works fine, even with a sharepoint list table, yet am having extreme, and no success with mysql, any ideas how to capture the autonumber/primary key when using .addnew?

Code:
Set rs = CurrentDb.OpenRecordset("qry_employee")
    rs.AddNew
    rs.Fields("EMP_LASTNAME").Value = Me.txtLastName
    rs.Fields("EMP_FIRSTNAME").Value = Me.txtFirstName
    rs.Update
    rs.Bookmark = rs.LastModified
    lngPatientID1 = rs!ID_EMPLOYEE
    rs.Close
    Set rs = Nothing
    lngPatientID2 = lngPatientID1
Set rs = CurrentDb.OpenRecordset("qry_employee_education")
    rs.AddNew
    rs.Fields("EMPED_ID_EMPLOYEE").Value = lngPatientID2
    rs.Fields("EMPED_NAME_OF_SCHOOL").Value = Me.txtNameofSchool
    rs.Fields("EMPED_SCHOOL_ZIPCODE").Value = Me.txtSchoolZipCode
    rs.Update
    rs.Close
    Set rs = Nothing
End Sub

P.S this is a testing code
 
You should be asking this question in the Web Design and Development section of the forum. Someone who does or knows a lot of PHP/MySQL would be able to help.

If you're inserting into a MySQL db instance you will need to use a MySQL function - nothing to do with Access.

Here's what I found:

http://dev.mysql.com/doc/refman/5.0/en/getting-unique-id.html
 

Users who are viewing this thread

Back
Top Bottom