Results 1 to 6 of 6
  1. #1
    everette is offline Novice
    Windows Vista Access 2007
    Join Date
    Oct 2010
    Posts
    17

    VBA rookie needs help

    I'm trying to do a auto time stamp using the code below. Does not work. Any help would be greatly appreciated.

    Private Sub Time1_Click()
    Dim Time1 As String
    Time1 = Time

    End Sub




    Thanks in advance
    Everette

  2. #2
    slave138's Avatar
    slave138 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Oct 2010
    Location
    WI
    Posts
    233
    Do you want just the Time or the Date and Time?

  3. #3
    everette is offline Novice
    Windows Vista Access 2007
    Join Date
    Oct 2010
    Posts
    17
    Quote Originally Posted by slave138 View Post
    Do you want just the Time or the Date and Time?
    Just the time, but thinking time and date would be good.
    Thanks
    Everette

  4. #4
    slave138's Avatar
    slave138 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Oct 2010
    Location
    WI
    Posts
    233
    You could use:
    Code:
    Private Sub Time1_Click()
       Me.txtTime.Value = Time
    End Sub
    Or for full date/time:
    Code:
    Private Sub Time1_Click()
       Me.txtTime.Value = Now()
    End Sub
    This assumes you want the timestamp to be stored/displayed in a field (called "txtTime" on the same form as Time1 (which I assumed was a button).

    If my assumptions were way off from what you are doing or hope to accomplish, please provide more details on your setup or upload a copy of the DB.

  5. #5
    everette is offline Novice
    Windows Vista Access 2007
    Join Date
    Oct 2010
    Posts
    17
    Thanks so much. It works great.
    Everette

  6. #6
    slave138's Avatar
    slave138 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Oct 2010
    Location
    WI
    Posts
    233
    My pleasure. Have a good weekend.

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

Similar Threads

  1. Rookie Messed Up Main Input Form
    By genest11 in forum Forms
    Replies: 2
    Last Post: 01-14-2010, 02:17 PM
  2. Rookie needs help with basic reporting
    By James Rousselle in forum Reports
    Replies: 0
    Last Post: 03-01-2007, 02:36 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