Results 1 to 5 of 5
  1. #1
    jlclark4 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Dec 2010
    Location
    North Carolina
    Posts
    155

    Record Time Stamp when Click New Record Command button

    Hey,

    Currently I have a onclick even for Command16

    Code:
    Private Sub Command16_Click()
    On Error GoTo Err_Command16_Click
    
        DoCmd.GoToRecord , , acNewRec
    Exit_Command16_Click:
        Exit Sub
    Err_Command16_Click:
        MsgBox Err.Description
        Resume Exit_Command16_Click
     
    
    End Sub
    I want the time (ProcessCompleteTime) and the date (ProcessCompleteDate) to record into the table (tblRegistration).

    Currently I renamed the text boxes to Text41 - (Date) and Text 42 - (Time) because I thought the name was the issue.

    Any ideas how to get this to work?!



    Thanks,

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,515
    In the new record or the record being exited? For the new, set the default value property either at the table level or the textboxes. For the existing record, before going to the new record:

    Me.DateTextboxName = Date()
    Me.TimeTextboxName = Time()

    Hopefully you don't have anything named Date or Time, as Access can confuse them with the functions of the same name.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    jlclark4 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Dec 2010
    Location
    North Carolina
    Posts
    155
    See, i thought that was the issue, so I renamed my feilds that used that as datea and timea...

    Concept is When they open the new form, current date is recorded into datea and current time is recorded into timea. When they go to a new record, I want a dateb and a timeb for when they exited that record...

    I have tried what you have given me before and I cant get it to work.

  4. #4
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,515
    Not seeing what you tried, and not knowing what "can't get it to work" means (error, wrong result, etc), I have no idea of what might be wrong.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    on the field you want the date/time store

    in the table design set it to date/time set it to general date (this will store the date and time)

    set the DEFAULT VALUE of that field to now()

    Whenever a new record is created it will put in whatever the date and time was when the record was created

    EDIT: if you can navigate away from the record only by button you could have something like

    me.EndDateTime = now()
    'then go to whatever else you were doing

    Something to be aware of if you only care about the date/time the record was created and originally closed that's one problem. If you want to record only the most recent time the record was touched that's another matter entirely and if you're doing this on a bound form you're goign to have a *ton* of records that will get updated (even if nothing changes about the record if people have the ability to tab through records just to see what's there.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Command button click event
    By R_jang in forum Programming
    Replies: 10
    Last Post: 10-29-2010, 10:13 PM
  2. Question about Button and Time Stamp
    By euroclyde in forum Access
    Replies: 2
    Last Post: 06-16-2010, 09:01 AM
  3. Updating another record table with command button
    By erlan501 in forum Programming
    Replies: 5
    Last Post: 04-26-2010, 09:03 AM
  4. Command button help - delete record
    By Zukster in forum Forms
    Replies: 0
    Last Post: 08-27-2009, 08:47 AM
  5. Date Stamp On Entry of Record
    By tscholts in forum Forms
    Replies: 3
    Last Post: 04-01-2008, 07:08 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums