[AccessD] DirtyFalse Procedure (was Dirty property)

Dan Waters df.waters at outlook.com
Thu Jul 23 08:18:34 CDT 2015


A while back I learned that I could call:

    Me.Dirty = False

to save the current record in a bound form.

This became a procedure in a module:
	
____________________________________
Public Sub DirtyFalse(frm As Form)

    '-- Purpose:  This is called by any form to update all data to
underlying tables

    If frm.RecordSource <> "" Then
        If frm.Dirty = True Then frm.Dirty = False
    End If

End Sub
____________________________________

I typically call this in a form like this:

    Call DirtyFalse(Me)

This gives me some control over saving data at desirable points in executing
code.  I use this frequently throughout my form's code.

It also avoids an error if the form's recordset happens to not exist at the
time, and only sends data to the table if the form is already Dirty.

HTH,
Dan




More information about the AccessD mailing list