PDA

Click to See Complete Forum and Search --> : Maintaining current date


Gimpster
Jan 21st, 2000, 02:16 AM
I know you can get the current date by using:

Text1.Text = Date

However, I'm going to be using this to automatically place the date in a Invoice form. This form may be left running on the computer over night and so I want to be able to have the date automatically roll over to the next day at midnight. I could do this using a Timer, but then I would have to have the timer constantly updating the date, and I don't want that. Is there any way to have VB just passively monitor the date, or have it tap into some API that would signal VB when the date has changed? Thanks.

------------------
Ryan

Aaron Young
Jan 21st, 2000, 02:19 AM
Why don't you just verify the Date before closing/resetting the Form?

------------------
Aaron Young
Analyst Programmer
aarony@redwingsoftware.com
ajyoung@pressenter.com

ChrisJackson
Jan 21st, 2000, 02:24 AM
Gimpster,

Sounds like you need to use the Now function.

If your program is running, this will do it for you.

Option Explicit

Private Sub Form_Load()
Timer1.Interval = 1000
End Sub

Private Sub Timer1_Timer()
If Time > #11:59:00 PM# Then
Text1 = Format(Now, "Short Date")
End If
End Sub

All the best.

Chris


[This message has been edited by ChrisJackson (edited 01-21-2000).]

Gimpster
Jan 21st, 2000, 02:58 AM
Ok, thanks.

------------------
Ryan