DataBase - Need to show continuous time in the form
Asked By naveen prasad
28-Jan-10 05:50 PM
hi all,
In my form I want to show continous system time,
it should show according to system time
I tried to add text box, and in form properties - on load event
text1.set focus
text1.text = now() this is showing date & time when form is loaded
but this is not correct , it is not changing as per system time continously
pls help
VBA
(1)
VB
(1)
TimerInterval
(1)
Windows
(1)
InThat
(1)
Timer
(1)
Consquence
(1)
Continous
(1)
Marshall Barton replied to naveen prasad
Do you really need to do that? The Windows task bar has a
decent clock going all the time.
If you have to have your own clock on your form, you need to
put the code in the form's Timer event with the
TimerInterval property set to the number of milliseconds
between updating the text box.
BTW, your old VB is showing ;-)
The Text property in Access is NOT used to set a text box's
value. Instead, use the Value property, which is the
default property so you do not even need to specify it. The
timer event code would simply be:
text1 = now()
BUT, there are consequences to using a timer event and in
general you should avoid using it. The primary consquence
is that you can not edit a VBA module while a timer is
running. The VBA editor thinks it is in charge of
keystrokes and suddenly your form gets control so the
keystrokes are going to the wrong place.
--
Marsh
MVP [MS Access]
naveen prasad replied to Marshall Barton
i really did not understand your concept.
kindly give me simple solution so that i can implement...
regards
John Spencer replied to naveen prasad
Apologies for butting in
That is about as simple as it gets.
In the form that has the time showing.
Set the Timer Interval property to 1000 (that is one second)
Set code in the Timer Interval event.
Private Sub Form_Timer()
Me.Text1 = Time()
End Sub
Now once every second while the form is open the Form_Timer event will execute
and update Text1 with the current system time.
John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
naveen prasad replied to John Spencer
wow superb conclusion dear.
it worked , thank you very much...
VB Editor Auto prompt turning off problem DataBase Hi there I am starting to write VB for my databases. Good so far but in some databases for example when I am in the VB Editor and write "DoCmd." I get a list of options but then it disappears. It to work out the rest of the prompts. Can someone help?????????? Duncan Access Queries Discussions VBA (1) VB (1) DetectIdleTime (1) Database (1) TimerInterval (1) Duncan (1) Duncanjx (1) Autoexec (1) On Sat, 3 May 2008 17:01:00 The usual "culprit" is that you have a form open (while you are editing the VBA) that has a timer event running. If the timer event is in a different form are editing, I strongly recommend that you go one step further and instead of setting TimerInterval to 0, that you switch the form back to design view before making *any* code
00:01# j'ai une erreur d'incompatibilité pouvez-vous m'aider?? merci Access Discussions VBA (1) VB (1) Timer (1) Format (1) Beep (1) Le (1) Salut, On ne peut pas faire 13, 0, 0) 'initalise le rebours Me.Lbl_Rebours.Caption = Format(dtRebours, "hh:mm:ss") Me.TimerInterval = 1000 End Sub Private Sub Form_Timer() ' retire une seconde dtRebours = dtRebours - TimeSerial(0, 0, 1 Caption = Format(dtRebours, "hh:mm:ss") If dtRebours < = 0 Then Beep MsgBox "Temps écoulé" Me.TimerInterval = 0 End If End Sub 4c76c46c$0$5387$ba4acef3@reader.news.orange.fr. . . Ah ben un peu expéditif. Mais bon, c'était vendredi, après deux semaines à donner un cours VBA, avec un apprenant qui m'a donné des hausses de pression artérielle. Un gars du n'utilise quasiment jamais le timer en Access, et j'étais parti dans un délire VB pur où le timer est un contrôle. Bon, j'ai corrigé le tir. a+, Blaise
1) Information (1) Database (1) Exits (1) Basically (1) Macro (1) Private Sub Form_Activate() Me.TimerInterval = 10000 End Sub Private Sub Form_Timer() Application.Quit End Sub Leaving the TimerInterval set at 0 (zero) in design view, and setting it programmatically in the Activate event MVP Thanks for your help, but is it possible to do through a macro ? My VB skill leave a lot to be desired Andy You don't need great VB skills: you have to type 2 lines of code (the VB Editor will give you the declaration and End statements), and Brendan's given them to know about macros. As Doug says, you don't need to know a lot about VBA, you can just copy and paste the code I posted. If you really want to i think ! Again, thanks Andy, This may be a great time to introduce yourself to VBA. With Access 2003 you can save the macro as a module, it will automatically convert the code to VBA, you can then insert this statement into it. While you are there, take a look
bisher nicht zielf?hrend. Gru? Michael Access Discussions Access 2003 (1) Office (1) Connect2WSUS (1) VBA (1) XP (1) VB (1) Debug.Print (1) CboPilot.RowSource (1) Michael K?nig schrieb: Kannst Du die Aktion neue DB und teste, ob der Fehler da auch auftritt. Und das komplette auskommentieren des VBA-Codes? HTH Gru? aus Kiel Reiner - - Nur, weil der Arzt einen Namen f?r deinen Formular direkt aufrufe, nur tut das Formular nix mehr; mein Verdacht geht ja in Richtung VBA, nur wie heraus finden, wenn ErrorHandling und Debugging nicht weiter helfen. Auch das Deinstallieren des und nicht unter Extras - Verweise. Da hat es im Laufe des letzten Jahres f?r VB ein paar kumulative Updates gegeben, die sehr viele dieser OCX-Dateien ausgetauscht hat. Schau doch OCX) irgendetwas gemacht hat. So ne DLL ist ja ein Kompilat von zB C++ oder VB oder sonst einer Programmiersprache und damit kein VBA-Code mehr. Falls es dem Auftraggeber besser gef?llt, kann ich den Auftrag auch offiziell Du das im Change-Event machst. Gruss Oliver Falls es unklar ist: Einfach 'cmdWeiter_Click Me.TimerInterval = 10 und Private Sub Form_Timer() Me.TimerInterval = 0 cmdWeiter_Click End Sub ingrid Hallo Ingrid, Oliver