Results 1 to 2 of 2
  1. #1
    gwaipor is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Mar 2016
    Posts
    1

    Display current time as a text in a form when a combo box is updated

    I have a form with a combo box. I would like the current date and time to be displayed on the form next to the combo box when the combo box is selected and updated.

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Welcome to the forum.....

    I would like the current date and time to be displayed on the form next to the combo box when the combo box is selected and updated.
    Sounds simple, but ......

    OK, the simple part:
    In the afterupdate event of the combo box, you would have something like this:

    Code:
    Sub Combobox_AfterUpdate()
         Me.TextBoxName = Now()
    End Sub
    Change "TextBoxName" to your text box name.
    (I don't have Access on this computer, so I can't text the code)

    Now the question is: Do you want to save the date and time?
    If yes, then the text box must be bound to a field in the recordset.


    Another question:
    If there is a date/time in the text box, do you want the date/time to change if a different selection is made from the combo box?
    If you do not want the original Date/time to change, you will have to add code to prevent the date/time change.

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

Similar Threads

  1. Replies: 1
    Last Post: 02-06-2016, 05:33 AM
  2. Replies: 8
    Last Post: 05-07-2014, 11:21 AM
  3. Need to refresh form to display updated data
    By pledbetter in forum Forms
    Replies: 3
    Last Post: 01-02-2014, 01:20 PM
  4. Replies: 1
    Last Post: 05-22-2013, 09:32 PM
  5. Replies: 1
    Last Post: 02-27-2012, 10:41 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