commit a record after a field is changed on a form…

  • Access, commit a record after a field is changed on a form…


    I make a change to a field on a form, but I see that the data in the table doesn’t change until I move off the record…


    ?i would like a way to commit the field change to the record immediately after the user makes the changes…?


    ???


    Thank you

  • Re: commit a record after a field is changed on a form…


    You haven't specified whether this is a 'bound' or 'unbound' form. However, I suspect that if you were using an unbound form, that you would not be asking this question.


    A simple fix for this is to simply 'requery' the form, thereby forcing a save. You would need to add an 'event procedure' to the 'after update' event of the control. A single line of code being which would look something like the following should do the trick.


    Private Sub MyControl_AfterUpdate()
    Me.Form.Requery
    End Sub


    However, be ready to add a bit more code as often you will find that one action leads to something unexpected happening which you then have to resolve. For example, you made need to take control of which control on the form receives the focus after this code executes.


    Hope this helps.


    Cheers

  • Re: commit a record after a field is changed on a form…


    thank you...


    i have found help with the following:

    Code
    1. If Me.Dirty = True Then
    2. Me.Dirty = False
    3. End If


    so far, so good...i'll stay in touch...


    thanks!