acClose form, Msg VBy/n

carlchapman

Registered User.
Local time
Today, 16:42
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?
 
You should be able to get this done using one or more of the 'dirty' settings or events... In Access help look up Dirty, OnDirty etc and see if these may help...
 
Fixed

Hi peps,

soz,, i suda played around abit more, the follwing works fine...

Private Sub Command47_Click()
On Error GoTo Err_Command47_Click

DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
DoCmd.Close

Exit_Command47_Click:
Exit Sub

Err_Command47_Click:
MsgBox Err.Description
Resume Exit_Command47_Click

End Sub

But now i have a new query, maby you can help.


On the same form i have a spell check running on a field >>>>

If Len(Me!chsNotes & "") > 0 Then
DoCmd.RunCommand acCmdSpelling
Else
Exit Sub
End If


Is their a way to disable this form being called if i click the exit and clear script above. ???
 
i suda played around abit more, the follwing works fine...

Private Sub Command47_Click()
On Error GoTo Err_Command47_Click

DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
DoCmd.Close
Couple of points, your code will only work if the form is closed with your button and domenuitem is obsolete, replace it with the RunCommand alternative or just Me.Undo.
 

Users who are viewing this thread

Back
Top Bottom