|
-
Apr 9th, 2011, 08:16 PM
#1
testing time delay
i would appreciate if anyone can see any possible cases where this routine could fail or error
or other possible improvements
the idea is to limit the maximum number if iterations (user set maxe) per hour, the test below i have changed to minutes, for testing purposes,
vb Code:
Sub test()
Dim strtime As Date, e As Long, maxe As Long
strtime = Now
maxe = 850
For e = 1 To 100000
If e Mod maxe = 1 And Not e = 1 Then
' .Disconnect
Do Until DateDiff("s", strtime, Now) > (e \ maxe) * 60
DoEvents
Sleep 3000
Loop
' .Connect
Debug.Print Now
End If
Next
End Sub
within the application, this is actually in a do loop, e = e +1, with unknown maximum, but i would expect to always be less than 100000
the computer is unlikely to be used for other purposes while this routine is running
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
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
|