Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Schedule a Vb program to run every 10 mins

Status
Not open for further replies.

vikramonline

Programmer
Oct 14, 2003
186
IN
I want a vb program to run every 10 mins,when my system is running.It is suppposed to pick all the new uploaded files from a folder,interpret them and store the relevant info in the database.

Any suggestions ??
 
To run your VB every 10 times, you could configure your Windows Scheduler to do it.
 
You can set up a timer. Here is one I use. I left the extraneous code in:

Code:
Private Sub Timer1_Timer()
    dEndTime = Now()
    sCancelTime = FormatDateTime(Now, vbShortTime)

    If iShutdownCounter > 4 Then
        With rsTempRecordSet
            If .State = adStateOpen Then
                .Close
            End If
            .ActiveConnection = cnCMS
            .LockType = adLockOptimistic
            .Source = "SELECT * from company  "
            .Open
            If .Fields("shutdownindicatorDrNetwork") = "1" Then
                Call ManualShutDown
            End If
            iShutdownCounter = "0"
        End With
    Else
        iShutdownCounter = iShutdownCounter + 1
    End If

' Ckeck the time.  If it falls in the range send a message, log the activity, end the application.

    If sCancelTime > "02:00" And sCancelTime < "02:15" Then
        txtMessage = "You have been automatically logged off of DrNetwork.  Please " _
        & "remember to log off before leaving for the day."
        Call sGetComputerName
        iMsgNumber = Shell(Environ$("COMSPEC") & " /C " & "Net Send  " _
        & sGetComputerName & " " & txtMessage)
        Call RecordLogin("NightlyShutDown", Now(), "ShutDown")
        Call cnCms_Close
        End
    End If

    Exit Sub
End Sub

You need to place the timer on the form. You can set the interval there. I think a minute is the max setting so that is why the counter is in the code. I think this one checks every five minutes becuase it is also a function to shut the system down at a selected time via a table entry.
 
oops. Sorry, I misread your post. You can make it a scheduled task if you are on Windows.
 
Do a search for NetScheduleJobAdd API

&quot;Two strings walk into a bar. The first string says to the bartender: 'Bartender, I'll have a beer. u.5n$x5t?*&4ru!2[sACC~ErJ'. The second string says: 'Pardon my friend, he isn't NULL terminated'.&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top