Results 1 to 3 of 3

Thread: MS Access - set current date/time

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jul 2004
    Posts
    29

    Resolved MS Access - set current date/time

    Hello.

    I know this is easy but I'm new to Access and can't figure this out. I would like a text box to display the current date/time and keep the time running, not just a snapshot. Is that possible? I tried to build an event with the expression builder. There, I found the current date/time. Even I knew it's coded as =Now() but that wouldn't work. I tried placing the =Now() on each property of the text box, on focus, on enter, on exit, after update, etc and none seemed to work for me. In the expression builder, I also tried clicking on the text box first then placing the =now() after that but that didn't work either.
    What's the easiest way to do this? Can't I just do it through the expression builder?

    Thanks.
    Last edited by bigu2fan00; Oct 15th, 2004 at 01:49 PM.

  2. #2
    Addicted Member
    Join Date
    Aug 2002
    Location
    Luton, UK
    Posts
    178
    I don't know if I really like this because my computer already shows the information in the taskbar. Any running process uses system resources. However, for the sake of the exercise :-

    The form Events are acccessed via the form Properties. Click the required event as below and choose [Event Procedure] and then click on the dotted button to get to the code module. Copy/Paste the 2 routines as below. It is interesting to see that this ticks away quite happily whilst other things are going on.

    Code:
    '- requires a textbox on the form called "Textbox1"
    '------------------------------------------------------
    Private Sub Form_Open(Cancel As Integer)
        '- set timer interval to 1 second
        Me.TimerInterval = 1000
    End Sub
    '------------------------------------------------------
    Private Sub Form_Timer()
        Dim MyTime As String
        MyTime = Format(Now(), "HH:MM:SS")
        Me.TextBox1.Value = MyTime
    End Sub
    '------------------------------------------------------
    Regards
    BrianB
    -------------------------------

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jul 2004
    Posts
    29

    Resolved

    Sweet!!! Thanks a lot.

Posting Permissions

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



Click Here to Expand Forum to Full Width