Solved

Verfiy Date and Time to Trigger

Posted on 1998-12-20
3
142 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

734 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