|
-
Jul 17th, 2000, 03:44 AM
#1
Thread Starter
Hyperactive Member
Hi
VB is easy when you know how, unfortunatly I don't know how
to do this:
My program needs to import a file every 2 hours without fail
from c:\reeldata_project , how do I use the timer to achieve
this as I have never used the timer before. The file is getting
loaded into an access data base ( which I have managed to do ).
This prog will run 24hrs a day.
Any help would be great.
Thanx, Locutus
-
Jul 17th, 2000, 03:56 AM
#2
Lively Member
Add a timer to the form.
Code:
Private Sub Form_Load()
Timer1.Index = 120000
'2 hours in miliseconds (I think)
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
AssimilateThatImportantFileHere
End Sub
That's it!
//Anders
-
Jul 17th, 2000, 04:20 AM
#3
Frenzied Member
It's not quite that easy
the Controls have a maximum interval of 65,535 milliseconds (just over 1 minute)
you could use a timer to check the time at 1 minute intervals...
Code:
Option Explicit
Dim NextRunTime As Date
Private Sub Form_Load()
Timer1.Interval = 60000
ReSetNextRunTime
End Sub
Public Sub ReSetNextRunTime()
NextRunTime = DateAdd("n", 120, Now)
End Sub
Private Sub Timer1_Timer()
If Now >= NextRunTime Then
'invoke code to run here
'and reset the next run time
ReSetNextRunTime
End If
End Sub
-
Jul 17th, 2000, 05:43 AM
#4
_______
<?>
Option Explicit
Private Sub Form_Load()
'set timer to check at just under 1 minuite intervals
'remember..timers are not as accurate as clocks..they
'do have missed moments...not big but over time they
'can make a slight difference
Set Timer1.Interval = 58000
End Sub
Private Sub Timer1_Timer()
Dim curTime As Date
curTime = Format(Now, "hh:mm AMPM")
If curTime = "12:01 AM" Or curTime = "02:00 AM" _
Or curTime = "04:00 AM" Or curTime = "06:00 AM" _
Or curTime = "08:00 AM" Or curTime = "10:00 AM" _
Or curTime = "12:01 PM" Then
MsgBox "Its time to do your whatevers"
End If
End Sub
[/code]
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|