hi guys,
I have just moved by Access BE across to MySQL BE at the insistence of the IT dept, and am having a couple of problems with things.
One of these been getting the ID last a record that has just been inserted. I used to get this no problem when it was an Access BE by using .bookmark and .lastmodified but these don't work with MySQL.
I have spent some time searching and found various methods but cant get any of them to work.
The records is inserting absolutely fine, but I cant get the ID back. Any idea's?
the below is just a test section of code to try and get it working.
thanks
I have just moved by Access BE across to MySQL BE at the insistence of the IT dept, and am having a couple of problems with things.
One of these been getting the ID last a record that has just been inserted. I used to get this no problem when it was an Access BE by using .bookmark and .lastmodified but these don't work with MySQL.
I have spent some time searching and found various methods but cant get any of them to work.
The records is inserting absolutely fine, but I cant get the ID back. Any idea's?
the below is just a test section of code to try and get it working.
thanks
Code:
Private Sub Command0_Click()
Dim db As DAO.Database
Dim IDI As Integer
Dim query As String
Dim rs1 As DAO.Recordset
Set db = CurrentDb
db.Execute "INSERT INTO SB_Test (TestText) VALUES ('Worked')"
Set rs1 = db.OpenRecordset("SELECT @@IDENTITY AS LastID;")
IDI = rs1!LastID
rs1.Close
Debug.Print IDI
Set rs1 = Nothing
Set db = Nothing
End Sub