Results 1 to 5 of 5

Thread: Date/Time Stamp

  1. #1
    Star Lounger
    Join Date
    May 2003
    Location
    Kansas City, Kansas, USA
    Posts
    76
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Unhappy

    Ok, I know my brain just is not working. I have two fields in a table that records request for changes in our database. I want it to automatically record the date and time the person created the record, and automatacally record the user's log on info. I know I have done the date/time thing before I just can't remember how.

    Thanks!
    Rachel

  2. #2
    Star Lounger
    Join Date
    May 2003
    Location
    Kansas City, Kansas, USA
    Posts
    76
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thank you I have found the answer for the date/time. I should have just kept looking! I believe that it is this:

    In your form's BeforeUpdate Event, just put in code like this:

    txtLastUpdated = Date( )

    Use Date( ) for just the date, use Now( ) if you want date and time.

    But, how do i store the users name automatacally??

  3. #3
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='RFlaggard' post='762417' date='28-Feb-09 15:54']But, how do i store the users name automatacally??[/quote]
    If you use User-Level Security and want to retrieve the Access user name use :
    txtuser = CurrentUser()

    If you want to retrieve the windows username have a look at :
    Access: Retrieve the user name from Windows in Access 2003/XP/2000/97
    Francois

  4. #4
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='RFlaggard' post='762417' date='28-Feb-09 15:54']In your form's BeforeUpdate Event, just put in code like this:
    txtLastUpdated = Date( )[/quote]
    If you want the creation date and the name of the creator you should use:
    Code:
    If Me.Newrecord Then
       txtLastUpdated = Date()
       txtuser = CurrentUser()
    End If
    Otherwise the time and user will be changed every time the record is modified.
    Francois

  5. #5
    Star Lounger
    Join Date
    May 2003
    Location
    Kansas City, Kansas, USA
    Posts
    76
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Ah, thank you so much Francois! I knew it was easy!

    Have a great day!

Posting Permissions

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