Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Save Prompt

Status
Not open for further replies.

Dilly

Technical User
May 28, 2001
41
0
0
GB
I have created a form to create new logistics requests. I want the system to prompt when the form is closed to ask whether or not saving is required. I have tried to create a macro but it still does not ask a question.
 
Hi Dilly, try the following in the BeforeUpdate event of your form (obviously, you can enter whaterver text you want between the quotes):

Private Sub Form_BeforeUpdate(Cancel As Integer)

Dim msg, style, title, response
msg = ("Do you want to save this request?")
style = vbYesNo + vbQuestion
title = "Save Request?"
response = MsgBox(msg, style, title)
If response = vbNo Then
Me.Undo
Else
Exit Sub
End If
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top