When I double click on a .MAM file, it starts, opens the database, creates reports and exits without error. When I run the .MAM from a macro, it sometimes gives an error, “x.MAM: Access to the device or file is denied". When that error occurs, the macro hangs, but the .MAM file completes and the Access window closes. The log file shows that, when the error occurs, no further macro commands are executed after the ExecuteFile>, so I can't try to detect the error window and close it. The error can occur at any time during the .MAM file's one minute execution.
When the error does not occur, execution proceeds immediately after the ExecuteFile>.
Here is a small example program that loops and eventually hangs:
Code: Select all
Let>k=0
Repeat>k
Let>k=k+1
DeleteFile>N:\Nightly\*.snp
Wait>2
ExecuteFile>N:\WeeklyAccessReports\MacroAllNightlyReports.MAM
Wait>2
Wait>1
WaitWindowClosed>Microsoft Access*
Wait>10
Until>k,20
Here is part of the log showing one success, followed by one failure.
Code: Select all
3/6/2008 16:50:18:102 - END: Repeat>k
3/6/2008 16:50:18:102 - START: Repeat>k
3/6/2008 16:50:18:102 - END: Repeat>k
3/6/2008 16:50:18:102 - START:
3/6/2008 16:50:18:102 - END:
3/6/2008 16:50:18:102 - START: Let>k=k+1
3/6/2008 16:50:18:102 - END: Let>k=k+1
3/6/2008 16:50:18:102 - START: DeleteFile>N:\Nightly\*.snp
3/6/2008 16:50:18:118 - END: DeleteFile>N:\Nightly\*.snp
3/6/2008 16:50:18:118 - START: Wait>2
3/6/2008 16:50:20:118 - END: Wait>2
3/6/2008 16:50:20:118 - START: ExecuteFile>N:\WeeklyAccessReports\MacroAllNightlyReports.MAM
It hung here, so I manually closed the error window and it continued.
3/6/2008 17:14:58:399 - END: ExecuteFile>N:\WeeklyAccessReports\MacroAllNightlyReports.MAM
3/6/2008 17:14:58:399 - START: Wait>2
3/6/2008 17:15:00:399 - END: Wait>2
3/6/2008 17:15:00:399 - START: Wait>1
3/6/2008 17:15:01:399 - END: Wait>1
3/6/2008 17:15:01:399 - START: WaitWindowClosed>Microsoft Access*
3/6/2008 17:15:01:399 - END: WaitWindowClosed>Microsoft Access*
3/6/2008 17:15:01:399 - START: Wait>10
3/6/2008 17:15:11:399 - END: Wait>10
3/6/2008 17:15:11:399 - START:
3/6/2008 17:15:11:399 - END:
3/6/2008 17:15:11:399 - START: Until>k,20
3/6/2008 17:15:11:399 - END: Repeat>k
3/6/2008 17:15:11:399 - START: Repeat>k
3/6/2008 17:15:11:399 - END: Repeat>k
3/6/2008 17:15:11:399 - START:
3/6/2008 17:15:11:399 - END:
3/6/2008 17:15:11:399 - START: Let>k=k+1
3/6/2008 17:15:11:399 - END: Let>k=k+1
3/6/2008 17:15:11:399 - START: DeleteFile>N:\Nightly\*.snp
3/6/2008 17:15:11:414 - END: DeleteFile>N:\Nightly\*.snp
3/6/2008 17:15:11:414 - START: Wait>2
3/6/2008 17:15:13:414 - END: Wait>2
3/6/2008 17:15:13:414 - START: ExecuteFile>N:\WeeklyAccessReports\MacroAllNightlyReports.MAM
3/6/2008 17:16:08:133 - END: ExecuteFile>N:\WeeklyAccessReports\MacroAllNightlyReports.MAM
3/6/2008 17:16:08:133 - START: Wait>2
3/6/2008 17:16:10:133 - END: Wait>2
3/6/2008 17:16:10:133 - START: Wait>1
3/6/2008 17:16:11:133 - END: Wait>1
3/6/2008 17:16:11:133 - START: WaitWindowClosed>Microsoft Access*
3/6/2008 17:16:41:821 - END: WaitWindowClosed>Microsoft Access*
I aborted the macro here
3/6/2008 17:16:41:821 - Finished Macro : testrun