On Insert vs On Change

Kiwi-Wombat

Registered User.
Local time
Today, 14:57
Joined
Aug 2, 2004
Messages
56
In a data entry form, when any field on the form is changed I want to enable a button that gives the user the ability to clear the data they have entered.

I can place the necessary code in the "Before Insert" event, but it relates to a new record only. Is there an equivalent for an existing record?

I know I can use the "On Change" event but it has to be for every field, tick box etc.

I was just wondering if there was a simpler way?
 
There's an answer posted on another site you posted this question on.
 
Hi Paul

The answer suggested was to use 'Dirty' but that is not an event as far as I know. I do use that elsewhere in my code already.

What I wanted was to run a piece of code whenever anything was entered into a field. That needs an event.

For a new record the event is "On Insert" and works well, but for an existing record it seems that all one can do is add code to the "On change" event for every single field.

I was just wondering if there was a simpler way.
 
You must use a different version of Access than I do:
 

Attachments

  • dirty.JPG
    dirty.JPG
    23.3 KB · Views: 123
Access 97 does not have that event.

I can see an upgrade coming up

Thanks for your help
 
Private Sub Cancel_Click()
On Error GoTo Err_Cancel_Click
If Me.Dirty = True Then
Me.Undo
Else
MsgBox "There is nothing to Undo"
End If

Exit_Cancel_Click:
Exit Sub

Err_Cancel_Click:
MsgBox Err.Description
Resume Exit_Cancel_Click

End Sub
 

Users who are viewing this thread

Back
Top Bottom