Solved

Verfiy Date and Time to Trigger

Posted on 1998-12-20
3
138 Views
Last Modified: 2010-05-03
I have an app that I want to verify Date and time from a value stored in a text file. dt.txt looks like this

12/20/1998 04:00am
I have a two lables that have captions, one for the Date and one for the Time, I'm using a time to update the caption for the time. I was thinking of haow I could use another time to check the "dt.txt" file and verfiy the captions and when the are the same to popup a msgbox. kind
of like and alarm clock with a calender.  any thoughts?
0
Comment
Question by:rhop
3 Comments
 
LVL 3

Accepted Solution

by:
jbil earned 100 total points
ID: 1451615
'This worked for me

Private Sub Form_Load()
Dim dtstr As String
Open "C:/dt.txt" For Input As #1
'format as 12/20/98 8:53:00 PM
Do While Not EOF(1)
   dtstr = Input(1, #1)
   mystr = mystr & dtstr
Loop

Close #1
'mystr = "12/20/98 8:47:00 PM" 'test str
Me.Show
Label1.Caption = Date
Alarm mystr
End Sub

Private Sub Alarm(ByVal mystr As String)

While Label1.Caption & " " & Label2.Caption <> mystr
    DoEvents
    Label2.Caption = Time
Wend
Beep
mystr = ""

End Sub

0
 
LVL 1

Expert Comment

by:muffinthedog
ID: 1451616
rhop,
    could set a timer on the "DateDiff" of seconds * 1000 like the following to eliminate the loop...

SetTime(DateDiff * 1000)

module level...

Declare Function SetTimer Lib "user32" (ByVal hWnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Declare Function KillTimer Lib "user32" (ByVal hWnd As Long, ByVal nIDEvent As Long) As Long

Private hTimer As Long


Sub SetTime(ByVal dwMilliseconds As Long)
    hTimer = SetTimer(0, 0, dwMilliseconds, AddressOf TimerProc)
End Sub

Sub TimerProc(ByVal hWnd As Long, ByVal uMsg As Long, ByVal hTimer As Long, ByVal dwTime As Long)
    MsgBox "Do something on event here"
    KillTimer 0, hTimer
End Sub

0
 

Author Comment

by:rhop
ID: 1451617
Thanks for the quick response. You got me going in the right direction.


0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now