Results 1 to 5 of 5
  1. #1
    Md1271 is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Sep 2012
    Posts
    2

    How to make the time update while in Form View


    I've added the date and time in the header of the form and would like to make the time update every 5 seconds while in Form view.
    Is there code I can write to make this possible?

    The name of the text box is "Auto_Time"

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Most developers let Windows take care of the time but if you must, use the Timer event of the form.

  3. #3
    Md1271 is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Sep 2012
    Posts
    2
    Sorry, I would like the time on the form to refresh every 5 seconds so the time viewed on the form can stay current with the time in windows. I don't want the time shown to stay stagnate, I want it the stay current.

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    As I said, use the Timer interrupt set at 5000. It is still resource intensive and sucks up a bunch of cpu cycles.

  5. #5
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    I've used these, for years, on a series of apps that had to be 'full-screen,' and have never had any resource problems, but RG's advice is given by many experts. I suspect that with today's faster processors it's not as much of a problem as it used to be! But, as they say, your mileage may vary!

    For your Textbox:
    Code:
    Private Sub Form_Open(Cancel As Integer)
    'Displays while waiting for timer to crank up
      Me.Auto_Time = Now
      Me.TimerInterval = 5000
    End Sub
    
    Private Sub Form_Timer()
      Me.Auto_Time = Now
    End Sub

    I really prefer doing this with a Label instead of a Textbox:
    Code:
    Private Sub Form_Open(Cancel As Integer)
    'Displays while waiting for timer to crank up
      Me.MyClock.Caption = Now
      Me.TimerInterval = 5000
    End Sub
    
    Private Sub Form_Timer()
      Me.MyClock.Caption = Now
    End Sub


    Also note that if you should start experiencing problems with 'screen-flicker' the Timer usage may be responsible!

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

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

Similar Threads

  1. Make time series data
    By klh_2012 in forum Access
    Replies: 1
    Last Post: 03-13-2012, 02:19 AM
  2. can i view two subdatasheets at a time?
    By neha in forum Access
    Replies: 4
    Last Post: 12-16-2011, 01:16 AM
  3. How to make a button on a form update report
    By Enemee in forum Programming
    Replies: 1
    Last Post: 07-05-2011, 11:24 AM
  4. View Created date and time for key in Registry
    By startop10 in forum Programming
    Replies: 2
    Last Post: 01-21-2011, 01:52 PM
  5. Replies: 1
    Last Post: 12-20-2010, 09:09 AM

Tags for this Thread

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