Full Version: Testing for dirty records
UtterAccess Forums > Microsoft® Access > Access Forms
kid_charlemagne
Hi folks
I have a form which includes 3 subforms. I want to trap any inadvertent changes the user makes when reviewing previously saved records, and prompt them 'do you want to save your change'. I have done this by testing for dirty in the main form's beforeupdate property. The problem is that when the user is creating a new form, this fires the 'do you want to save your change' message when they move from the main form to one of the subforms. I only want the message to fire if they go to a previously-created record and change the data on the main or sub forms.
Is this possible?
Thanks in advance for your help.
JayNoelOlimpo
HI;
se ...
CODE
If me.NewRecord Then
Else
    If me.Dirty Then
         If msgbox("Do you want to save your change ?", vbYesNo) = vbYes Then
             me.Dirty = False
        End If
    End If
End If

'*** air code not tested
HTH.
kid_charlemagne
That's great - thanks very much!
JayNoelOlimpo
Glad to be of assistance. thumbup.gif
GOOD LUCK!
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.