acSavePrompt

campo88

Registered User.
Local time
Today, 01:15
Joined
Nov 20, 2009
Messages
46
Hi

The form closes fine but I do not get a prompt for saving changes. Please help!

Also is there a way of tailoring the prompt message that is displayed?

Code:
[COLOR=blue]
Private Sub Quit_Click()
DoCmd.Close acForm, "main_form", acSavePrompt
End Sub
[/COLOR]

I would actually like to quit the entire access application. How is this possible?




 
Hi

The form closes fine but I do not get a prompt for saving changes. Please help!

Also is there a way of tailoring the prompt message that is displayed?

Code:
[COLOR=blue]Private Sub Quit_Click()[/COLOR]
[COLOR=blue]DoCmd.Close acForm, "main_form", acSavePrompt[/COLOR]
[COLOR=blue]End Sub[/COLOR]

I would actually like to quit the entire access application. How is this possible?

What is this? A Joke?
If this is not a joke try this:

Docmd.close acform, me.name
Docmd.quit
 
I suspect the problem is that you, like many, don't understand what the arguments

acSavePrompt
acSaveYes
acSaveNo

really do. I'm guessing that you expect them to deal with data that has been changed when, in fact, they deal with changes in the form's design that has been made!

To have the user prompted when data has been changed, you need to use validation code in the Form_BeforeUpdate event. Here's one example of that:
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Not (Me.NewRecord) Then
 If MsgBox("Would You Like To Save The Changes To This Record?", vbQuestion + vbYesNo + vbDefaultButton1, "Save Changes to Record ???") = vbNo Then
  Me.Undo
 End If
Else
 If MsgBox("Would You Like To Save This New Record?", vbQuestion + vbYesNo + vbDefaultButton1, "Save This Record ???") = vbNo Then
  Me.Undo
 End If
End If
End Sub
 

Users who are viewing this thread

Back
Top Bottom