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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running Scheduler Task from VBA in Access

Status
Not open for further replies.

TJVFree

Technical User
Nov 22, 2010
236
US
I’m trying to write a VBA Script that will run a query or it need be Macros similar to have MS Scheduler Task works. This is what I have so far, but doesn’t seem to be working.

Anyone have some help or advice?

Thanks for taking the time
Code:
Private Sub Form_Timer()

On Error GoTo Err_Command34_Click

    Dim stDocName1 As String
    Dim SysHour, SysTime
    Dim SysDay, SysDate
    
    stDocName1 = "Performance Reporting for Manual Dates"
    SysTime = time()
    SysHour = Hour(SysTime)
    SysDate = Date
    SysDay = Day(SysDate)
          
If SysHour = Now Then
          

    DoCmd.RunMacro stDocName1
           
     End If

    
Exit_Command34_Click:
    Exit Sub

Err_Command34_Click:
    MsgBox Err.Description
    Resume Exit_Command34_Click

End Sub
 
If SysHour = Now Then
This will NEVER happen ...

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top