Results 1 to 4 of 4

Thread: Maintaining current date

  1. #1

    Thread Starter
    Hyperactive Member Gimpster's Avatar
    Join Date
    Oct 1999
    Location
    Redmond, WA 98052
    Posts
    331

    Post

    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

  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    Why don't you just verify the Date before closing/resetting the Form?

    ------------------
    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]


  3. #3
    Lively Member
    Join Date
    Oct 1999
    Posts
    101

    Post

    Gimpster,

    Sounds like you need to use the Now function.

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

    Code:
    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).]

  4. #4

    Thread Starter
    Hyperactive Member Gimpster's Avatar
    Join Date
    Oct 1999
    Location
    Redmond, WA 98052
    Posts
    331

    Post

    Ok, thanks.

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width