Results 1 to 2 of 2
  1. #1
    New Lounger
    Join Date
    Apr 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I am building a database to track security access to our offices. I have several tables and the main data entry is done on a main form with two subforms. On the main form and on one of the subforms, I have a textbox that puts the last date/time that record was updated. Seems to work great. Until I try using the subform after updating the main form. I cannot move from the main form to the subform after this textbox updates. The whole form freezes.

    I'm very new to VBA, and I tried looking at the code to figure this out myself. It appears the textbox is locking after it updates. If I edit it to leave it unlocked, it doesn't seem to matter. So, I guess I have no idea what I'm doing.

    I can attach the db if that will help you.

    What I want is: On the main form (employee information), when I enter data into the last form on the field (year), I want the date/time last updated to appear on the form (the textbox) and then I want to be able to go to a subform (locations employee accesses with permissions for access) to enter records and have that subform also show a date/time last updated.

    So, should I attach the db or are you a magician and can understand what I've just babbled about?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Welcome to the Lounge!

    I usually set the last modified date of a record in the Before Update event of the form. For example:

    Code:
    Private Sub Form_BeforeUpdate(Cancel As Integer)
      Me.txtDateModified = Date
    End Sub
    Here, txtDateModified is a text box bound to a Date/Time field in the table behind the form.

Posting Permissions

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