Run Program yeilds error
Moderators: JRL, Dorian (MJT support)
Run Program yeilds error
Hi Folks,
I am trying to run an access Macro from the Macro Scheduler, but when I run it I get an error stating that there was an error executing "C:\Pathtoaccess\msaccess.exe" "M:\Pathtodatabase\databasename.mdb /x UpdateCRMN3 (2)
The only thing that I can see here that is incorrect is the (2) at the end of the error. THis is not part of the macro name. Is this just part of the error or is it nothing. Anyone venture to guess why this is erroring out?
Thanks,
-Joe
I am trying to run an access Macro from the Macro Scheduler, but when I run it I get an error stating that there was an error executing "C:\Pathtoaccess\msaccess.exe" "M:\Pathtodatabase\databasename.mdb /x UpdateCRMN3 (2)
The only thing that I can see here that is incorrect is the (2) at the end of the error. THis is not part of the macro name. Is this just part of the error or is it nothing. Anyone venture to guess why this is erroring out?
Thanks,
-Joe
The (2) at the end is the error code.
"C:\Pathtoaccess\msaccess.exe" "M:\Pathtodatabase\databasename.mdb /x UpdateCRMN3 (2)
List of error codes from help for Run Program>:
"C:\Pathtoaccess\msaccess.exe" "M:\Pathtodatabase\databasename.mdb /x UpdateCRMN3 (2)
List of error codes from help for Run Program>:
So an error code of 2 indicates possibly an incorrect path or file name? I see a missing quote at the end of what you posted.0 - The system was out of memory, or the executable file was corrupt, or relocations were invalid. (RP_WAIT=0 only)
2 - The file was not found.
3 - The path was not found.
5 - An attempt was made to dynamically link to a task, or there was a sharing or network protection error.
6 - The library required separate data segments for each task.
10 - The Windows version was incorrect.
11 - The executable file was invalid. It was either not a Windows-based application or there was an error in the .EXE image.
12 - The application was designed for OS/2.
13 - The application was designed for MS-DOS 4.0.
14 - The type of executable file was unknown.
15 - An attempt was made to load a real-mode application (developed for an earlier version of Windows).
16 - An attempt was made to load a second instance of an executable file containing multiple data segments that were not marked "read-only."
17 - Attempt in large-frame EMS mode to load a second instance of an application that links to certain non-shareable DLLs already in use.
18 - Attempt in real mode to load an application marked for protected mode only.
error codes....
hmmm error codes that help. nice concept. It is not the quote, that was a typo here on the forum. I will investigate this based on te error code 2 not that I know what that is. Thank you. this is helpful.
-Joe
-Joe
still not working - path seems ok
I just verified the path, shortened the Macro name (no spaces) and it still does not work. I even tried the UNC to the database and that gave the same error. There is a mapped drive to that database and the user has full access rights to the folder and file. Anyone have any other ideas? any other way to call an access macro from the MJTNet MS?
-Joe
-Joe
more oddities
Additional info:
I changed the command to point to an access macro shortcust which I created from within access (create shortcut by right clicking the macro) and placed that macro on the network drive. I changed the macro scheduler to use a, Execute File command and pointed it to the shortcut. I ran the Macro from quick launch. It fired the macro from the database, but after it ran the macro, it errored and stated that access could not find the path to the Access Macro shortcut (filename.mam) Any ideas what migh be causing this? I just dont get it.
-Joe
I changed the command to point to an access macro shortcust which I created from within access (create shortcut by right clicking the macro) and placed that macro on the network drive. I changed the macro scheduler to use a, Execute File command and pointed it to the shortcut. I ran the Macro from quick launch. It fired the macro from the database, but after it ran the macro, it errored and stated that access could not find the path to the Access Macro shortcut (filename.mam) Any ideas what migh be causing this? I just dont get it.
-Joe
Does "C:\Pathtoaccess\msaccess.exe" "M:\Pathtodatabase\databasename.mdb" /x UpdateCRMN3 work from a DOS command line?
If yes try:
If no then I have a long-winded method of opening an Access Macro that I haven't used since someone posted the /X method. It'll take me some time to look to see what I used to do.
If yes try:
Code: Select all
Let>RP_WAIT=0
Let>RP_WINDOWMODE=0
Run>cmd /c "C:\Pathtoaccess\msaccess.exe" "M:\Pathtodatabase\databasename.mdb" /x UpdateCRMN3
WaitWindowOpen>Access*
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Odd that you need to use cmd /c. Just to be sure I set up a very similar scenario - running a macro in an MDB which is stored on a network drive. This is my code:
Run>"K:\Program Files\Microsoft Office\Office12\msaccess.exe" "Y:\Marcus\TEST.MDB" /x Macro1
It worked fine.
Regarding knowing whether it worked or not, if you didn't get an error it should have done, but the only way to know if the Access macro ran would be to check the outcome of that macro. So, yes, if that macro changes data I guess you need to look at that data and see if it changed!
My test macro above displayed a message box so that I could see that it worked. You can also make Access macros sound the computer speaker using the Beep command. So you might want to add one or other of those commands to your Access macro as a quick way to test it and get a visual/audible clue that it's working.
Run>"K:\Program Files\Microsoft Office\Office12\msaccess.exe" "Y:\Marcus\TEST.MDB" /x Macro1
It worked fine.
Regarding knowing whether it worked or not, if you didn't get an error it should have done, but the only way to know if the Access macro ran would be to check the outcome of that macro. So, yes, if that macro changes data I guess you need to look at that data and see if it changed!
My test macro above displayed a message box so that I could see that it worked. You can also make Access macros sound the computer speaker using the Beep command. So you might want to add one or other of those commands to your Access macro as a quick way to test it and get a visual/audible clue that it's working.
Last edited by Marcus Tettmar on Thu Jan 22, 2009 6:10 pm, edited 1 time in total.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
I did add the beeps to the access macro, ran it from within access and it beeped. THen I ran it from the macro scheduler (using the CMD line) and it diddnt beep indecating that it never got called (or at least it did not run)
Also, I do have another MJTnet macro running an access macro with the X switch commands ON A NETWORK DRIVE, just as Marcus had suggested and that one work fine! So I am at a loss. Got anything else?
Also, I do have another MJTnet macro running an access macro with the X switch commands ON A NETWORK DRIVE, just as Marcus had suggested and that one work fine! So I am at a loss. Got anything else?
-Joe
I remember now. When using ExecuteFile> with an Access macro shortcut, that message you described comes up making you think that somethng failed... but nothing failed. You just have to add a couple lines after the ExecuteFile> line to close that window.I changed the command to point to an access macro shortcust which I created from within access (create shortcut by right clicking the macro) and placed that macro on the network drive. I changed the macro scheduler to use a, Execute File command and pointed it to the shortcut. I ran the Macro from quick launch. It fired the macro from the database, but after it ran the macro, it errored and stated that access could not find the path to the Access Macro shortcut (filename.mam) Any ideas what migh be causing this? I just dont get it.
WaitWindowOpen>macroname.mam* macroname.mam*
Wait>0.5
Press Esc
It still not clearing the "error". I tried all that was suggested and I am left with the following. the macro just hangs waiting for the error box to be gone. The access window closes and the access macro is run, but the error box is not cleared and the MJTNet macro does no progress.
-Joe
-Joe
Code: Select all
Execute File>C:\UDCRMN3.mam
WaitWindowClosed>Microsoft Access
Wait> 10.5
Press Esc
so on and so forth thru macro........
I added the asterisk, but it still does not close the error box.
Here is the code I have now:
the title of the error box is c:\UDCRMN3.mam [/img]
Here is the code I have now:
Code: Select all
Execute File>C:\UDCRMN3.mam
WaitWindowClosed>Microsoft Access*
Wait> 10.5
Press Esc
-Joe
I'm not sure that you need to wait for Access to close, rather, you want to wait for the error window to open. Then after the error window opens you need to make sure it is the focused window so that the Esc key press lands on that window and closes it.
Try this:
Try this:
Code: Select all
WaitWindowOpen>UDCRMN3.mam*
SetFocus>UDCRMN3.mam*
Wait>0.5
Press Esc