Results 1 to 11 of 11
  1. #1
    New Lounger
    Join Date
    Jul 2002
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Update (Access 2000)

    I am trying to make a field that as soon as you edit existing rows in a table the field will give the present date. This will be a property on a form that shows when the document was last updated. Thanks.

  2. #2
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Update (Access 2000)

    Let's assume this field is named DateLastUpdated, and you place a textbox (name it txtDateLastUpdated) on your form that is bound to the field. In your form's BeforeUpdate event, place this line of code:
    txtDateLastUpdated = Date( )
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  3. #3
    New Lounger
    Join Date
    Jul 2002
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Update (Access 2000)

    I am sorry, but this did not work. I want the form to show the date updated, but this is a read only form. The updates are going to be in the tables. If you can help me, I would really appreciate it.

  4. #4
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Edmonton, Alberta, Canada
    Posts
    326
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Update (Access 2000)

    You can't find out when a record was updated without using a field in your table to record that date, and without using appropriate code in the forms used to update the records. If you are updating records by accesssing the table directly, then you're out of luck; tables don't have events that you can put code in. If you want to remember when a record was created then you can just put date() as the default for the field in the table (although the value can always be changed if you give people read-write access to the table directly).

    Not sure what you mean by the comment that you are using a read only form. If you can't change the data then clearly there's no update to record. You'll need to put the code previously mentioned in the forms that are used to update the records. As long as you stick it in the beforeupdate event code, simply viewing the record won't cause the value to be changed.

  5. #5
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Update (Access 2000)

    There is no way for you to control when a record in a table get updated, unless you do it thru a form. Do you mean that data entry is being done directly into the table? This isn't a good idea.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  6. #6
    New Lounger
    Join Date
    Jul 2002
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Update (Access 2000)

    I tried to use the coding, but I still can not get it to work. I am the only person changing information, so it does not matter if I updte in the table or form. Please write back if you can help me. Thanks

  7. #7
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Update (Access 2000)

    The coding will work only if you do data entry via the form, but you said your form is read-only. There is NO WAY in table entry to detect that a record has been changed, nor to automatically do anything. The ONLY way to get this functionality is to do data entry via a form.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  8. #8
    New Lounger
    Join Date
    Jul 2002
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Update (Access 2000)

    The form is no longer a read only. I tried changing data in the form, and I am not getting a new date.

  9. #9
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Update (Access 2000)

    You wrote:
    >>The form is no longer a read only. I tried changing data in the form, and I am not getting a new date. <<


    What code are you using and where is the code located?
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  10. #10
    New Lounger
    Join Date
    Jul 2002
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Update (Access 2000)

    I am using the code txtDateLastUpdated, and it is under BeforeUpdate in the coding. txtLastUpdated is the Name of the label for Last updated(the field.)

  11. #11
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Update (Access 2000)

    You wrote:
    >>I am using the code txtDateLastUpdated, and it is under BeforeUpdate in the coding. txtLastUpdated is the Name of the label for Last updated(the field.) <<

    First, let's get some terminology straight. I assume you mean that txtLastUpdated is the name of the textbox control that is bound to the field LastUpdated? A Label is another control type, and is not bound to a field.

    Then you said you were "...using the code txtDateLastUpdated". Exactly what do you mean by that? Could you show me the exact code you are using? And is this code in the Form's BeforeUpdate event? (each control has a BeforeUpdate event also.)
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

Posting Permissions

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