I upgraded back-end MS Access 2003 to MySQL 5.1 of a database. I am linking the backend MYSQL 5.1 database thr' ODBC (MySQL ODBC 5.1 Driver) to MS Access front-end .mdb.
I am using DAO recordset. I add new record by using .AddNew method and update by using
.Update method; after update statement I fetch autonumber field into variable which gives
"Run-time error '-2147352567 (80020009)' No Current Record " error.
But same code works in previous version which has MS-Access 2003 back end.
'new
if bNew = true then
lngInvoiceID = 0
else 'edit ,
lngInvoiceID = Forms("frmInvoice").[tbInvoiceID].value
end if
Set rstAux = dbsLocal.OpenRecordset("Select * from tblElectronicInvoices where
eipID = " & lngInvoiceID, dbOpenDynaset, dbSeeChanges)
rstAux.AddNew
rstAux.Update
lngInvoiceID = Nz(rstAux.Fields("eipID"), 0)
'Getting No current record error when I try to get back eipID which is autonumber field.
Previous MS Access code has access back-end linked table to front-end. The option of dbSeeChanges was not specified and before the update statement, I could get new ID of autonumber field.