How do I make a form in access dirty when a filed is changed programatically?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Angelo Perillo
    New Member
    • Jul 2010
    • 2

    How do I make a form in access dirty when a filed is changed programatically?

    The Dirty function in access is not working for a field that is "programaticall y" updated. Is there any solution for that?
  • Stewart Ross
    Recognized Expert Moderator Specialist
    • Feb 2008
    • 2545

    #2
    The dirty property cannot be set true by programmatic intervention - unlike setting it false (which saves the current record).

    When you set the field value concerned programmaticall y you can set up a value you can test by making use of the rather overlooked Tag property of the control bound to that field, or the tag property of the form itself, to specify that the field has been updated. Using the control's tag property as an example:

    Code:
    Me!YourField = <whatever you do to update the field programmatically>
    Me!YourField.Tag = "Updated"
    Then, where you normally test for Me.Dirty you can add a test for this tag value too:

    Code:
    If Me.Dirty or Me!YourField.Tag = "Updated" then
       Me.Dirty = False
       Me!YourField.Tag = ""
    End If
    -Stewart
    Last edited by Stewart Ross; Jul 30 '10, 11:02 PM.

    Comment

    • Angelo Perillo
      New Member
      • Jul 2010
      • 2

      #3
      This solution works really well. Thanks Stewart.

      Comment

      • Avadhesh666
        Banned
        New Member
        • Jul 2010
        • 2

        #4
        Stewart thanks for this solution it really works.

        Comment

        Working...