I'm working my way slowly through VBA in Access (2016) and am experimenting with adding a record, saving changes, and not saving changes.
In the code below, I Open the form frmContacts, but when I run the code, the form is opened but the MsgBox immediately appears and there is no option to edit the data in the form.
What am I missing hear?
Thanks, JeffSub mynewworkspace()
Dim myR As Recordset, myWS As Workspace
Set myR = CurrentDb.OpenRecordset("Contacts")
Set myWS = DBEngine.Workspaces(0)
myWS.BeginTrans
DoCmd.OpenForm ("frmContacts")
myR.Edit
myR.Update
If MsgBox("Save Changes? ", vbQuestion + vbYesNo) = vbYes Then
myWS.CommitTrans
Else
myWS.Rollback
End If
End Sub