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!

running sql job from Access

Status
Not open for further replies.

fmientjes

Programmer
Mar 27, 2002
55
NL
I managed to start a sql-job from Access.

=============================================
Public Sub fnExecuteSQLjob(strJobName As String)

Dim oSQLServer As SQLDMO.SQLServer2
Set oSQLServer = New SQLDMO.SQLServer2
oSQLServer.LoginSecure = True
oSQLServer.Connect "server-name"

Dim oJobServer As SQLDMO.JobServer2
Set oJobServer = oSQLServer.JobServer

Dim oJob As New SQLDMO.Job
Set oJob = oJobServer.Jobs(strJobName)
lngLastRunTime = oJob.LastRunTime
oJob.Invoke
==============================================
If I run oJob.CurrentRunStatus immediately after oJob.Invoke I get status 4 = not active.
The job runs for 20 minutes, and if I start it agaan from Access I get a message that the job is still running (which is true).

I want to have a way to check if the job is ready or still executing.
Maybe I need some kind of refresh?

Frans
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top