MS Access Forum / Forms / July 2008
Realtime clock on a form
|
|
Thread rating:  |
firecop1 - 25 Jun 2007 23:52 GMT Is there an easy way to put a real time clock onto a form and if so can anyone explain the process?
Thanks in advance
Andrew J. Brofman Chief Fire Marshal Lake Grove, NY
Douglas J. Steele - 26 Jun 2007 00:20 GMT Check out http://www.mvps.org/access/forms/frm0032.htm at "The Access Web"
 Signature Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no private e-mails, please)
> Is there an easy way to put a real time clock onto a form and if so can > anyone explain the process? [quoted text clipped - 4 lines] > Chief Fire Marshal > Lake Grove, NY fredg - 26 Jun 2007 00:22 GMT > Is there an easy way to put a real time clock onto a form and if so can > anyone explain the process? [quoted text clipped - 4 lines] > Chief Fire Marshal > Lake Grove, NY Is a Digital clock OK?
Add an unbound text control to the form. Set it's Format property to Long Time Name this control "TheTime".
The Long Time format will display the time as 4:17:34 PM
If you wish to include the date as well as the time 6/25/2007 4:19:17 PM then set the Format property to General date.
Set the Form's TimerInterval property to 1000 Code the Form's Timer event: Me![TheTime] = Now()
That should be all you need do.
The time will increment in 1 second intervals.
 Signature Fred Please respond only to this newsgroup. I do not reply to personal e-mail
missinglinq - 26 Jun 2007 00:27 GMT Hello, again, Chief!
Here's a thing I use. You'll need a textbox called txtOmega (yeah, I'm a watch fanatic) and you'll maybe want to add some cosmetics to it, like a frame around it. If you'd also like to show the date, add a textbox called txtDayRunner.
Goto your form’s property box. Under the Event Tab find Timer Interval and enter 1000.
Private Sub Form_Open(Cancel As Integer) 'Displays while waiting for timer to crank up Me.txtOmega = Time End Sub
Private Sub Form_Timer() Me.txtOmega = Time 'Display time Me.txtDayRunner = Date 'Display date End Sub
 Signature There's ALWAYS more than one way to skin a cat!
Answers/posts based on Access 2000
firecop1 - 26 Jun 2007 02:19 GMT I can only keep thanking you over and over. sAs you can tell I am not a programmer but I am trying my best to make this work...You are helping me more than you know.
Thanks for the great advice and I am trying it out now.
Andrew J. Brofman Chief Fire Marshal Lake Grove, NY
> Hello, again, Chief! > [quoted text clipped - 15 lines] > Me.txtDayRunner = Date 'Display date > End Sub firecop1 - 26 Jun 2007 18:22 GMT Yep worked like a charm however I now see "Calculating..." on the bottom bar of the window and every six seconds the entier window flashes twice.
How would i change the time to military?
>I can only keep thanking you over and over. sAs you can tell I am not a >programmer but I am trying my best to make this work...You are helping me [quoted text clipped - 26 lines] >> Me.txtDayRunner = Date 'Display date >> End Sub missinglinq - 26 Jun 2007 19:02 GMT Replace
Me.txtOmega = Time
with
Me.txtOmega = Format(Time, "HH:MM:SS")
to get military time.
As to the flickering, is the Timer Interval set to 1000 as opposed to 100? I saw this behavior when I was developing this routine, but only at lower Timer Intervals. Check and if it is at 1000, try increasing it in 100 increments until it disappears.
I have no idea where the "Calculating..." is coming from! Never heard of such a thing; maybe someone else here has! What version of Access and what Windows OP are you using? Exactly where is this showing up?
 Signature There's ALWAYS more than one way to skin a cat!
Answers/posts based on Access 2000
firecop1 - 26 Jun 2007 19:17 GMT Yep, I have the timer set for 1000 and will try to bring it up. The "Calculating..." message comes up along the lower frame of the open database window. As it alternates with the field type that is currently selected along the bottom frame of the open databse window.
> Replace > [quoted text clipped - 18 lines] > Windows > OP are you using? Exactly where is this showing up? missinglinq - 27 Jun 2007 11:31 GMT I have to admit, I have no idea of what you're speaking. What version of Access and what version of Windows are you running? Perhaps Access 2003 or Access 2007?
>Yep, I have the timer set for 1000 and will try to bring it up. The >"Calculating..." message comes up along the lower frame of the open database [quoted text clipped - 6 lines] >> Windows >> OP are you using? Exactly where is this showing up?
 Signature There's ALWAYS more than one way to skin a cat!
Answers/posts based on Access 2000
firecop1 - 27 Jun 2007 15:57 GMT I M running Access 2007 Ok the best way to describe where the "Calculating...." message is it shows up in the same spot where the status bar text shows up as it alternates with whatever test is in there for the field that is highlighted.
>I have to admit, I have no idea of what you're speaking. What version of > Access and what version of Windows are you running? Perhaps Access 2003 or [quoted text clipped - 11 lines] >>> Windows >>> OP are you using? Exactly where is this showing up? missinglinq - 28 Jun 2007 18:37 GMT As I said, I've never run into this before, but I post on a number of other Access forums and will see if I can find out what it's about and if there's a workaround. I should also add that anytime you post a new question, you need to be sure and specify that you're using Access 2007! The reason is that ACC2007 is such a departure from all previous versions that many things that pertain to it don't pertain to previous versions and vice versa!
Linq
 Signature There's ALWAYS more than one way to skin a cat!
Answers/posts based on Access 2000
missinglinq - 30 Jun 2007 18:20 GMT Hey, Chief!
I've gotten responses from a number of experts about the "Calculating..." message and no one can explain why the clock code would bring this about. It does display if complicated calculations are being done, but there are *no* calculations in the code I provided. You said that the message "alternates with the field type that is currently selected." What *field type* ? What is the exact text that appears?
Have a great weekend!
Linq
 Signature There's ALWAYS more than one way to skin a cat!
Answers/posts based on Access 2000
firecop1 - 01 Jul 2007 14:45 GMT Well aside from this the code works very well.. I tweaked the timing settings and it is much smoother now.
Thanks Linq
> As I said, I've never run into this before, but I post on a number of > other [quoted text clipped - 8 lines] > > Linq missinglinq - 01 Jul 2007 18:36 GMT HEy, Chief!
I finally heard from an old hand on another site and he suggested trying to eliminate the problem by writing the time and date to labels instead of text boxes. If you want to give it a go:
Backup your db file! You really should do this after closing the db anytime you spend more than 15-20 minutes making changes, and *at least* once a day if you've used the db!
In Design View
Select txtOmega Goto Format - Change To Select Label
Repeat these steps for txtDayRunner
Then, in code, copy and paste this code over your old code for these two subs (or insert the code in Form_Open if you have stuff in there not pertaining to the clock hack) :
Private Sub Form_Open(Cancel As Integer) 'Displays while waiting for timer to crank up Me.txtOmega.Caption = Format(Time, "HH:MM:SS") Me.txtDayRunner.Caption = Date 'Display date End Sub Private Sub Form_Timer() Me.txtOmega.Caption = Format(Time, "HH:MM:SS") 'Display time Me.txtDayRunner.Caption = Date 'Display date End Sub
Now, by default the background color of labels is the same as the color of the form section they appear on, so you'll probably want to change this to make it stand out. Right click on the label then use
Fill/Back Color Font/Fore Color Special Effect
to change the appearance to something easier on the eye.
Linq
 Signature There's ALWAYS more than one way to skin a cat!
Answers/posts based on Access 2000
ArcticWolf - 23 Jul 2008 10:04 GMT Hi,
I get a run time error '438' but I am trying to max the screen aswell. Anyone know where I'm going wrong. I would ideally like the time and a max'd screen.
Private Sub Form_Open(Cancel As Integer)
DoCmd.Maximize Me.txtOmega = Time
End Sub
Thanks in advance,
AW
> Hello, again, Chief! > [quoted text clipped - 15 lines] > Me.txtDayRunner = Date 'Display date > End Sub jahoobob - 02 Jul 2007 00:00 GMT I've got to ask why? Windows has a clock at the bottom right of the screen with the exact same time that you will have in your form (as a matter of fact, I believe the Windows clock is the source of the Access Time.) I can look right now and tell you my local time is 7:00 PM. I realize there is a lot of sarcasm in this message but I think sometimes database designers (Access in particular) try to put too much fluff in the db just because we can.
>Is there an easy way to put a real time clock onto a form and if so can >anyone explain the process? [quoted text clipped - 4 lines] >Chief Fire Marshal >Lake Grove, NY missinglinq - 02 Jul 2007 01:26 GMT There are people who use "full screen" forms for design purposes and/or to maximize "real estate." And in this case, as noted above, the OP wants the time display in military time. I don't know anyway to do that in Regional Settings.
 Signature There's ALWAYS more than one way to skin a cat!
Answers/posts based on Access 2000
missinglinq - 02 Jul 2007 01:59 GMT I take that back! You actually can set the display for military time!
 Signature There's ALWAYS more than one way to skin a cat!
Answers/posts based on Access 2000
Gina Whipp - 02 Jul 2007 05:06 GMT Just a 'food for thought'. While the database is in military time I don't wat to look over to my system clock and see military time. I know I had a case like this.
 Signature Gina Whipp
"I feel I have been denied critical, need to know, information!" - Tremors II
>I take that back! You actually can set the display for military time! firecop1 - 02 Jul 2007 17:31 GMT Sometimes the obvious is not so obvious... When my Fire Marshals are in their trucks at night and look over at the screen it is much easier to see the large yellow/black clock I have on the form than it is to see the microscopic clock on the task bar. So in essence I am trying to reduce the accident potential. And if your next question is why dont they use the clock on the truck radio....I work for the government-there is no radio.
Andy
> I've got to ask why? Windows has a clock at the bottom right of the > screen [quoted text clipped - 15 lines] >>Chief Fire Marshal >>Lake Grove, NY missinglinq - 02 Jul 2007 20:21 GMT Hey,Chief!
Posters here are just like many people in life, they tend to see the world thru the narrow viewport of their own experiences, never giving thought that there may be other realities! Unfortunately, this deosn't keep them from trying to force their views on others! My philosophy over the years has been to simply ignore posters that only criticize without giving any positive suggestions!
Linq
 Signature There's ALWAYS more than one way to skin a cat!
Answers/posts based on Access 2000
jahoobob - 02 Jul 2007 22:24 GMT Okay missing, I guess you are referring to me. I stated that I had to ask why. I didn't try to force my way on anyone as I said sometimes designers put too much fluff in the db. The chief, explained why he needs the time in the form. I certainly do see that police or fire in a mobile situation need a large clock and I don't believe this is fluff. You, sir have shown that your nom de plume is appropro in that you are missing something when you infer things from a post as you have mine. You need to read things more closely before jumping in.
>Hey,Chief! > [quoted text clipped - 6 lines] > >Linq missinglinq - 02 Jul 2007 22:48 GMT Wow, jahoobob! My post wasn't a slam at you, or anyone else in particular! I was just explaining to the Chief, who is new both to Access and the world of forums, that many posters only answer posts according to their own experiences, and if his needs fall outside of those experiences, he needs to ignore their advice, however well intentioned it was! If I was going to slam you, I'd call you by name! In point of fact, the only alledged person I've ever been unkind to, here or on any other forum, is that bane of all of here, Aaron Kemph, aka Steve, aka whoever's name he's currently hijacking for his diatribes/advertising! Just as an aside, to anyone else looking in, I understand tha Kemph has also taken to tracking down posters' email address when he can, and is emailing them offering his services!
 Signature There's ALWAYS more than one way to skin a cat!
Answers/posts based on Access 2000
missinglinq - 02 Jul 2007 22:55 GMT BTW, jahoobob, I totally agree with your comment about many developers putting "fluff" into their apps! I make several visits to about six forums a day, and the day never goes by without my seeing half a dozen or more posts from people who want to do the most assinine things with their DBs! And the truly sad thing is that these are the same people who don't have a clue about the most basic functions of Access!
 Signature There's ALWAYS more than one way to skin a cat!
Answers/posts based on Access 2000
jahoobob - 03 Jul 2007 01:45 GMT My apologies. Sorry for jumping to an erroneous conclusion.
>BTW, jahoobob, I totally agree with your comment about many developers >putting "fluff" into their apps! I make several visits to about six forums a >day, and the day never goes by without my seeing half a dozen or more posts >from people who want to do the most assinine things with their DBs! And the >truly sad thing is that these are the same people who don't have a clue about >the most basic functions of Access! missinglinq - 03 Jul 2007 04:07 GMT As Senor Wences' Pedro used to say,"s'awright!" ;0)>
 Signature There's ALWAYS more than one way to skin a cat!
Answers/posts based on Access 2000
missinglinq - 03 Jul 2007 12:43 GMT Hey, Chief!
Unless you need the status bar for some other reason, I think you can get rid of the "Calculating..." message by simply not displaying the task bar!
Goto Tools - Startup and unchecking the "Display Task Bar"
Linq
 Signature There's ALWAYS more than one way to skin a cat!
Answers/posts based on Access 2000
firecop1 - 04 Jul 2007 02:47 GMT Linq, Did just that..
Safe 4th to you Andy
> Hey, Chief! > [quoted text clipped - 5 lines] > > Linq missinglinq - 04 Jul 2007 09:41 GMT Stow that bunker gear and grab some R & R, Chief!
Linq
 Signature There's ALWAYS more than one way to skin a cat!
Answers/posts based on Access 2000
|
|
|