I wasn't able to schedule a macro using the windows scheduler. When I schedule it, I get an error saying 'RunMacro was canceled'. Below is the macro converted to VB. Any help or comments is greatly appreciated. The same macro runs fine in access 2003 but not in access 2007. Thanks in advance.
And are there anyway to automatically schedule this VB using windows scheduler?
Option Compare Database
'------------------------------------------------------------
' Pub_Emails_Load_Macro
'
'------------------------------------------------------------
Function Pub_Emails_Load_Macro()
On Error GoTo Pub_Emails_Load_Macro_Err
DoCmd.SingleStep
DoCmd.SetWarnings False
DoCmd.OpenQuery "Delete Query", acViewNormal, acEdit
DoCmd.Close acQuery, "Delete Query"
DoCmd.SetWarnings True
DoCmd.Quit acExit
Pub_Emails_Load_Macro_Exit:
Exit Function
Pub_Emails_Load_Macro_Err:
MsgBox Error$
Resume Pub_Emails_Load_Macro_Exit
End Function
I wasn't able to schedule a macro using the windows scheduler. When I schedule it, I get an error saying 'RunMacro was canceled'. Below is the macro converted to VB. Any help or comments is greatly appreciated. The same macro runs fine in access 2003 but not in access 2007. Thanks in advance.
And are there anyway to automatically schedule this VB using windows scheduler? Code in code tags below.
Code:Option Compare Database '------------------------------------------------------------ ' Pub_Emails_Load_Macro ' '------------------------------------------------------------ Function Pub_Emails_Load_Macro() On Error GoTo Pub_Emails_Load_Macro_Err DoCmd.SingleStep DoCmd.SetWarnings False DoCmd.OpenQuery "Delete Query", acViewNormal, acEdit DoCmd.Close acQuery, "Delete Query" DoCmd.SetWarnings True DoCmd.Quit acExit Pub_Emails_Load_Macro_Exit: Exit Function Pub_Emails_Load_Macro_Err: MsgBox Error$ Resume Pub_Emails_Load_Macro_Exit End Function
Your macro doesn't open, or specify a file. Your asking it to run a delete qury.
Where is it suppose to get that delete query from?
Ask yourself this, if you were sitting at your idle computer, and someone said, "run the delete query" what would you have to do? You would have to open up access. Open the database that you have your data and delete query in. Then you would have to run the query. Your Macro was designed inside access so it's assumed that it will only run within the access environment. Windows can't possible know which program or file "delete query" belongs to.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks