I have a macro in MSACESS that I want to run as a scheduled task, without a gui and any confirmation windows that pop up. The macro inserts records into a table. This is what it looks like...
Public Sub Update_Burndown_Metrics()
Dim SQL_Text As String
Dim CurrDate As String
CurrDate = DateValue(CStr(Now()))
SQL_Text = "insert into BurnDownMetrics (project, domain, tot_effort_spent, tot_effort_left, tot_est_effort, when_captured) select project, domain, sum(effort_spent), sum(effort_left), sum(tot_effort), '" & CurrDate & "' from tasks group by project,domain"
DoCmd.SetWarnings (False)
DoCmd.RunSQL SQL_Text
DoCmd.SetWarnings (True)
End Sub
This macro works fine when run interactively in an Access session. It also runs fine when I run it from a .bat like this...
"C:\Program Files (x86)\Microsoft Office\root\Office16\MSACCESS.EXE" \\Somewhere\Somewhere_else\tdb.accdb /cmd Update_Burndown_Metrics
The one caveat in this mode is that a window pops up asking me if I really want to insert the records. The answer to that will always be "yes".
Now, I want to run the .bat as a scheduled task. I do not want the gui and I don't want the pop-up. Can this be done ?
I tried sticking "Application.Visible = False" in the macro. Didn't work. I think this may be for ExCel only?