Access 2010 front end UI and a MySQL back end.
I am opening a form on a click event to add a new record.
When the form opens, I can add data and the save and close the form - everything works fine.
At the time the record is saved, the PK is created and all data is saved. Until then, there is no PK.
I would like to create a PK when the form is opened, and know what the value of the PK is when created.
How would I go about doing this.
Here's the click code that I use to open the form and add a new record:
Code:
DoCmd.OpenForm "frm_devices", acNormal, "", "[ID]=" & Nz(ID, 0), , acDialog
If (IsNull(ID)) Then
TempVars.Add "CurrentMCDID", Nz(DMax("[ID]", Form.RecordSource), 0)
End If
End
DoCmd.SearchForRecord acForm, "frm_devices", acFirst, "[ID]=" & TempVars!CurrentMCDID
TempVars.Remove "CurrentMCDID"