Message on leaving record

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How would I go about popping up a message before leaving a record? I want
the person to verify all the information before they leave the record because
once they move on they can't return. Any suggestions on how to do this or a
better way of accomplishing this task?

Thanks!
 
How would I go about popping up a message before leaving a record? I want
the person to verify all the information before they leave the record because
once they move on they can't return. Any suggestions on how to do this or a
better way of accomplishing this task?

Thanks!

Use the Form's BeforeUpdate event. View the Form's Properties; on the
Event tab, click the ... icon by the Before Update event. Choose the
Code Builder, and write code like

Private Sub Form_BeforeUpdate(Cancel as Integer)
Dim iAns As Integer
iAns = MsgBox("OK to save this record?", vbYesNo)
If iAns = vbNo Then
Cancel = True
End If
End Sub

I'm not sure what you mean by "they can't return" - that's not an
Access limitation; is it one that you have imposed (say by making the
Form's AllowEdits property False)?

John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
How would I go about popping up a message before leaving a record? I want
the person to verify all the information before they leave the record because
once they move on they can't return. Any suggestions on how to do this or a
better way of accomplishing this task?

Thanks!

Use the Form's BeforeUpdate event to present a message and ask if it's
OK to go on. If the answer is No, cancel the update.

If MsgBox("Is it OK to save this record?", vbExclamation + vbYesNo,
"Save?") = vbNo Then
Cancel = True
End If
 
Back
Top