Ok to save changes?

  • Thread starter Thread starter Paul
  • Start date Start date
P

Paul

Good day....

How does one prompt a user to save changes? I have a form
to add clients. What I want to do is prompt the user
with 'OK to save changes' if they edit the form.

Cheers
 
Use the BeforeUpdate event procedure of the *form*. That is the only way to
catch all the possible things that could trigger the saving of the record.

Private Sub Form_BeforeUpdate(Cancel As Integer)
If MsgBox("Save?", vbOkCancel) = vbCancel Then
Cancel = True
'Me.Undo
End If
End Sub
 
Thanks Allen!

-----Original Message-----
Use the BeforeUpdate event procedure of the *form*. That is the only way to
catch all the possible things that could trigger the saving of the record.

Private Sub Form_BeforeUpdate(Cancel As Integer)
If MsgBox("Save?", vbOkCancel) = vbCancel Then
Cancel = True
'Me.Undo
End If
End Sub

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.




.
 
Good day....

How does one prompt a user to save changes? I have a form
to add clients. What I want to do is prompt the user
with 'OK to save changes' if they edit the form.

Cheers

You can use the Form's BeforeUpdate event for this purpose:

Private Sub Form_BeforeUpdate(Cancel as Integer)
Dim iAns As Integer
iAns = MsgBox("OK to save changes?", vbYesNo)
Cancel = (iAns = vbNo)
End Sub

John W. Vinson[MVP]
(no longer chatting for now)
 
Back
Top