Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2003
    Posts
    17

    Unanswered: My Beforeupdate() function makes it annoying to switch records

    I've created a simple beforeupdate() function which updates a date modified text box on my form. This is so i'll know how old the information is. When i change anything on a record and try to change to another record it updates the field and does not change records. Here is my coding:


    Private Sub Form_BeforeUpdate(Cancel As Integer)
    Date_Mod.SetFocus
    Date_Mod.Text = Date
    End Sub

    I believe that the setfocus method is killing my ability to change records because when date_mod has the focus it immediately changes records. Any help is appreciated!

  2. #2
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    Not sure if this answers your question or not...

    The before_update is the wrong place to set values on the form.
    It causes an infinite loop. Your procedure performs an update
    (date_mod.text=date), that update calls the before_update sub,
    etc....

    Try putting it in the after_update.
    Inspiration Through Fermentation

  3. #3
    Join Date
    Sep 2003
    Posts
    17
    Originally posted by RedNeckGeek
    Not sure if this answers your question or not...

    The before_update is the wrong place to set values on the form.
    It causes an infinite loop. Your procedure performs an update
    (date_mod.text=date), that update calls the before_update sub,
    etc....

    Try putting it in the after_update.
    It's not causing an infinite loop in my case but when i hit the next record or previous record it just sets focus on the date_mod text box and changes it. When the text box already has the focus, it switches records. This function i wrote does work but i have to press the record button at least two times to change records from a record i've updated. For the users sake i would like to correct it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •