Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Nov 2006
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Create and Modified Date (Access 2000)

    How do the following in a table and form automatically.

    1) Store the date that the record was created
    2) Store the date that the record was modified

    Any assistance would be much appreciated.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Create and Modified Date (Access 2000)

    In a table. you can automatically sotre the date the record was created:
    - Add a field named CreateDate to the table.
    - Set its Data Type to Date/Time.
    - Set its Default Value to Date() for the date only, or to Now() for the date and time.
    For the date the record was last modified, you need a form, for a table does not have a trigger that fires when a record is modified. The date will be stored in the table, however.
    - Add a field named ModifyDate to the table.
    - Set its Data Type to Date/Time.
    - In the form used to edit records, add code to the Before Update of the form:

    Private Sub Form_BeforeUpdate(Cancel As Integer)
    Me.ModifyDate = Date
    End Sub

    If you want to store the date and time instead of just the date, use Now instead of Date.

  3. #3
    New Lounger
    Join Date
    Nov 2006
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Create and Modified Date (Access 2000)

    Thanks Hans

    This works. Sorry for delay in replying

    However, I am unable to select Form and BeforeUpdate from the object and procedure menus at the top of the screen. Is there any reason why this is?

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Create and Modified Date (Access 2000)

    You can create the event procedure for the Before Update event as follows:
    - Open the form in design view. Don't select anything on the form.
    - Activate the Event tab of the Properties window.
    - Click in the Before Update box.
    - Select [Event Procedure] from the dropdown list.
    - Click the builder button (the one with three dots ...) to the right of the dropdown arrow.
    The Object and Procedure dropdown lists near the top of the module window that appears should now contain Form and BeforeUpdate, respectively.

Posting Permissions

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