Results 1 to 7 of 7
  1. #1
    karmadog is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2014
    Posts
    20

    Insert Now(0) with OnClick into a Text Box


    I'd like to click into a text box and have the current Date/Time inserted into the text box. Can someone tell me the code for that?

  2. #2
    keiath is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2013
    Posts
    162
    you can use this =Date() and this will show the current date in the text box

  3. #3
    karmadog is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2014
    Posts
    20
    Click image for larger version. 

Name:	4-21-2014 1-33-32 PM.jpg 
Views:	13 
Size:	64.4 KB 
ID:	16205Thanks Keiath.

    I get a syntax error, so I need the complete syntax.....

    Private Sub Comments_Click()
    =Date()
    End Sub

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    me.TextboxName.Value = Now

  5. #5
    karmadog is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2014
    Posts
    20
    Thanks ItsMe...that's what I was looking for.

    Now I just need to make it stop inserting the date/time after the first OnClick so I can write some text!

  6. #6
    karmadog is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2014
    Posts
    20
    Never mind... I changed to OnFocus and it works like it should.

  7. #7
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Cool, don't think I would have thought of that.

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

Similar Threads

  1. INSERT INTO from multi line text box
    By Only4Access in forum Forms
    Replies: 3
    Last Post: 01-08-2014, 08:06 PM
  2. Replies: 4
    Last Post: 10-15-2012, 11:38 AM
  3. Replies: 1
    Last Post: 09-20-2012, 03:15 PM
  4. calculat text box and insert to field
    By barakkadosh in forum Access
    Replies: 3
    Last Post: 05-15-2012, 12:45 PM
  5. Replies: 3
    Last Post: 01-05-2012, 10:47 AM

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