FredixBlog


Just my log about anything I could find enjoyable.



Dirty Flag for unbound form

author Posted by: fredometro on date Jan 15th, 2004 | filed Filed under: MS-Access

The dirty flag doesn’t work when the form is unbound. Here the technique is to use the validation rule like an event in order to set the flag. Easy: A simple function returning the control’s text itself can do the job!
I bother for the performance so my code also checks for the existence of a former validation rule. Setting properties of many controls could make the form open slower without this check.
Once the form is first opened with this method, then saved, there is no need of re-doing the function so the form opens faster because for sure testing for the existence of SetDirty validation rule will make an exit.

Private Sub Form_Open(Cancel As Integer)
Dim ctr As Control
Dim frm As Form
Set frm = Me
For Each ctr In frm
    On Error Resume Next
    if ctr.validatonrule=”SetDirty()” then ‘ Already done, let’s not smash an open door!
        exit sub
    On Error Goto 0
    if isempty(ctr.Validationrule) then
        ctr.ValidationRule = “SetDirty()”
    end if
Next ctr
End Sub

And, of course don’t forget the SetDirty function:

Public Function SetDirty()
    IsDirty = True
    SetDirty = Me.ActiveControl.Text
End Function

The full EE thread can be read here:

http://www.experts-exchange.com/Databases/MS_Access/Q_11879478.html.html

tag26 Responses to “Dirty Flag for unbound form”

  1. JaneRadriges Said,

    The article is ver good. Write please more

  2. Pdgyxsxl Said,

    XINMhg comment5 ,

  3. CrisBetewsky Said,

    Hello! Thanks for the post. It is really amazing! I will definitely share it with my friends.

  4. ChrisPark Said,

    Hello. My name is Chris. I’m from USA. I’m new to this forum, i was hoping you could maybe teach me some stuff.

    This is me-> http://lmageshack.us/img/chrisP.jpg - Just so you know who i am! feel free to post your own photos. Allways best to know who you talk to!

  5. brand viagra Said,

    “Thank you for the suggestion, sir,” The Bishop answered sweetly. “But I think I
    —————– gse55565se6g6dfg21 ——————
    order propecia 5mg without prescription

  6. viagra 50mg Said,

    was like a chess game that you played in your head. I could see the opening moves
    ———————————–
    generic viagra professional 100mg

  7. diflucan 200mg Said,

    Harrison - SSR 6 - A Stainless Steel Rat Is BornUC buy allegra “What bright side?”

  8. Expikivenen Said,

    for the accusing words. Waited . . . let my eyes travel up the blue-clad legs . . . pharmacy schools

     Add A Comment

You must be logged in to post a comment.