Hi!
I am struggeling to save an edited record.
This is my save button:
Code:
Private Sub SaveButton_Click()
Dim SaveButtonUsed As Boolean
SaveButtonUsed = True
DoCmd.RunCommand acCmdSaveRecord
MsgBox "Saved!"
Me.SaveButton.Enabled = False 'Only enabled after pressing Edit button
Me.AllowEdits = False
Me.AllowAdditions = False
End sub
I use this code to prevent any save unless SaveButton is clicked:
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If SaveButtonUsed = False Then
Me.Undo
End If
End Sub
Somehow the before update event prevents the savebutton from working. It works if I leave out this last code.
Why is this, and what will fix it?