View Full Version : Stopping BeforeUpdate event if. . .


WebFaktor
03-15-2002, 10:09 AM
Can a Before Update event (including its message boxes) be prevented from occuring if the Before Update event is coded to recognize that if it's activated from a particular source (like an exit this form and subform without saving records - button) that it will not run?

Lots to learn.

Thanks in advance,

Michael

Pat Hartman
03-15-2002, 10:38 AM
To do this you would need to define a form level public variable. You will need to set the value in various events:

Dim WhatEvent As String

Private Sub Form_Current()
WhatEvent = "Current"
End Sub

Private Sub Form_Close()
WhatEvent = "Close"
End Sub

Private Sub Form_BeforeUpdate(Cancel as Integer)
If WhatEvent = "Close" Then
Cancel = True
Exit Sub
End If

other code ....

End Sub

WebFaktor
03-15-2002, 11:05 AM
Pat,

If you wouldn't mind, could you go alittle further in advising me how to implement your design.

Thanks in advance,

Michael

DBL
03-15-2002, 01:29 PM
Hi Michael

I've just given an answer to your other posting regarding the same thing
http://www.access-programmers.co.uk/ubb/Forum4/HTML/006175.html

Pat Hartman
03-16-2002, 08:18 AM
Posting the same question multiple times will not help your cause. It will only annoy the people whose help you want. Stick to a single thread so people can see what has allready been sugested.