Link to home
Start Free TrialLog in
Avatar of baddogi
baddogi

asked on

Calculation Question

I need to call a SQL SP with this following idea:

Start January 10th
Run once every 2 weeks until January 10th

I don't know how to code VB for this.  I know how to code the following:

 Do While frmmain.Caption = "Employee Time Tracking Tool"
    DoEvents
   If Hour(Now) = 6 And Minute(Now) = 35 Then

    Set qy9ActiveConnection = conn1
    qy9.CommandType = adCmdStoredProc
    qy9.CommandText = "sp"
    qy9.Execute
ASKER CERTIFIED SOLUTION
Avatar of gencross
gencross

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If you have a routine that runs at least once each day, then you can do this:

Dim vTestDate as variant
vTestDate = CDate("1/10/2003)"

If DateDiff("d", Date(), vTestDate) Mod 14 = 0 Then

   Set qy9ActiveConnection = conn1
   qy9.CommandType = adCmdStoredProc
   qy9.CommandText = "sp"
   qy9.Execute

End if

What this will do is tell you if the current date is (2 Weeks * n) away from the critical date.
Avatar of baddogi
baddogi

ASKER

Thanks to all responders.  I knew it had to be something simply but when you're stressed you can't think clearly.

I think this should work fine.

Thanks,