Solved

Verfiy Date and Time to Trigger

Posted on 1998-12-20
3
144 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month7 days, 13 hours left to enroll

632 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