Visual Basic Run-time Error 76 (Path Not Found) - Task Scheduler Problem
Posted on 2010-08-17
Run-time 76 error (path not found) generated.
Software/Versions Used: MS Access 2007 Macro, MS Server 2008 OS, Task Scheduler, SQL Server 2008
A scheduled task is kicked off nightly. It invokes an MS Access Macro (visual basic) that imports data into a SQL Server database. The macro resides on a virtual server, "oemvm". The MSS database and log files reside on the database server, "oeppodb1-pri1" (oeppodb1 alias). The database server is mapped to the z: drive. The VB code fails with a "path not found" on this instruction:
Open StartFilePathName For Output As #1
Snippets of code that precede instruction:
Dim StartFilePathName As String
'Location of ASCII export file
PathName = "Z:\SAA_Export.txt"
'Location of log files
StartFilePathName = "Z:\HISTORY\Start_SAA_Export-" & Date$ & ".txt"
StatusFilePathName = "Z:\HISTORY\SAA_Export-" & Date$ & ".txt"
Code has executed since 2005. Has not been changed. Believe problem may be related to how the scheduled task is set up. A colleague corrupted the task while I was on vacation. Problem began occurring when I recreated the task.
The task is set up in Task Scheduler as follows:
Program/script - "C:\Program Files\Microsoft Office\Office12\MSACCESS.EXE"
Arguments - "C:\SAA_IMPORT_EXEC\Rosters SQL.mdb" /x "SAA_Import_Macro"
Start In - set to nothing...this may be part of the problem
Z: drive is mapped to \\oeppodb1-pri1\saa where "saa" is the share. Same results when alias oeppodb1 is used.