Trouble with event order??

CarlyS

Registered User.
Local time
Today, 02:40
Joined
Oct 9, 2004
Messages
115
Can anyone point me in the right direction on this...

I have a field on a form where data can be added or edited.
I would like to have a message box appear when the data in the field has been changed.

I do not want the message box to appear when a new record is added. I tried using the On Change Event, but then every time a key is pressed they get the message box and had to click "ok" before typing the next letter. This included new records as well.

Is the a way that I can summon my message box only after a previously created record has been edited and the person has finished typing?

Thanks for any pointers!
Carly
 
Do not use the OnChange event. Use the AfterUpdate event instead. For example, if your field name is MyField, then the following code should work in the form's code module:
Code:
Private Sub MyField_AfterUpdate()
    If Me.NewRecord = False Then
        MsgBox "Your text here"
    End If
End Sub
See if this works for you.
 
That was it! Thank you.
 
beware, though, that the record will already have been saved if you use the After Update event. if you want to send a message after editing, but before saving (before the user leaves the field or before the form is closed), use the Before Update event. - w
 

Users who are viewing this thread

Back
Top Bottom