469,287 Members | 2,764 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,287 developers. It's quick & easy.

Having a clock displayed on a Form

36
i am trying to create a clock with the date that i could display on a form? can someone help me design a basic one? any help would be appreciated
Apr 16 '07 #1
4 12560
ADezii
8,800 Expert 8TB
i am trying to create a clock with the date that i could display on a form? can someone help me design a basic one? any help would be appreciated
For a Date and Digital Clock display on your Form:
  1. Place a Lablel Control on your Form and name it lblClock.
  2. Set the appropriate Properties such as Font, Font Size, Bold, Text Alignment, etc. for the Label.
  3. Set the Form's Timer Interval to 1000 (1 second)
  4. Place the code listed below in the On Timer() Event of the Form
  5. The Clock will update itself every second - see sample output below
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Timer()
  2.   'There are many variations on the Date/Time display Format
  3.   'this is just one of them
  4.   Me![lblClock].Caption = Format$(Now(), "dddd, mmm dd, yyyy - hh:mm:ss AM/PM")
  5. End Sub
Output:
Expand|Select|Wrap|Line Numbers
  1. Sunday, Apr 15, 2007 - 09:17:39 PM
Apr 16 '07 #2
atiq
36
For a Date and Digital Clock display on your Form:
  1. Place a Lablel Control on your Form and name it lblClock.
  2. Set the appropriate Properties such as Font, Font Size, Bold, Text Alignment, etc. for the Label.
  3. Set the Form's Timer Interval to 1000 (1 second)
  4. Place the code listed below in the On Timer() Event of the Form
  5. The Clock will update itself every second - see sample output below
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Timer()
  2.   'There are many variations on the Date/Time display Format
  3.   'this is just one of them
  4.   Me![lblClock].Caption = Format$(Now(), "dddd, mmm dd, yyyy - hh:mm:ss AM/PM")
  5. End Sub
Output:
Expand|Select|Wrap|Line Numbers
  1. Sunday, Apr 15, 2007 - 09:17:39 PM
I followed these steps but when i tested the form it when into VB window and highlighted the Format$ while displaying the following error message:

Compile error:

Can't find project or library


any ideas how i can fix this?
Apr 16 '07 #3
yeah....I tested myself.

Its working fine. But, Why it is blinking..?

Any alternation need to be done..?

Thnx..

ngr..
Apr 16 '07 #4
pks00
280 Expert 100+
Hi Atiq

the problem you say, u may have reference problems. In the vba window of Access, go to Tools/References. Are there any listed as missing?

Some alternatives to the digital clock (solution already provided)

How about a progressive clock?
http://www.functionx.com/vbaccess/articles/progressclock.htm

Or maybe even an analogue clock
http://www.thescripts.com/forum/thread487187.html


solargovind, I suggest you open a new question if you want to get answers
refer to this question
Apr 16 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by ratlhead | last post: by
reply views Thread by Maileen | last post: by
2 posts views Thread by JDW | last post: by
5 posts views Thread by tbeers | last post: by
6 posts views Thread by shapper | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.