acClose form, Msg VBy/n

carlchapman

Registered User.
Local time
Today, 06:26
Joined
Jul 25, 2006
Messages
29
Hi again,

I am looking for a simple alternative to my problem... When you close a form in accees, the form saves auto. Is their a way to generate a bit of VBA where, on acform close , msg vb y/n, If no then exit and clear contents of form, do not save and do not pass go. If yes, carry on as normal and save?

Or has access got a function built in to do this? i am aware of the function with buttons, but do these exit with out saving and clearing?
 
Hello: Please see example below
Regards
Mark


MsgBox Function Example
This example uses the MsgBox function to display a critical-error message in a dialog box with Yes and No buttons. The No button is specified as the default response. The value returned by the MsgBox function depends on the button chosen by the user. This example assumes that DEMO.HLP is a Help file that contains a topic with a Help context number equal to 1000.

Dim Msg, Style, Title, Help, Ctxt, Response, MyString
Msg = "Do you want to continue ?" ' Define message.
Style = vbYesNo + vbCritical + vbDefaultButton2 ' Define buttons.
Title = "MsgBox Demonstration" ' Define title.
Help = "DEMO.HLP" ' Define Help file.
Ctxt = 1000 ' Define topic
' context.
' Display message.
Response = MsgBox(Msg, Style, Title, Help, Ctxt)
If Response = vbYes Then ' User chose Yes.
MyString = "Yes" ' Perform some action.
Else ' User chose No.
MyString = "No" ' Perform some action.
End If
 
great, thankyou :) it 70% of what i needed, im sure ill be ok with the rest :)
 

Users who are viewing this thread

Back
Top Bottom