Hi there
I have a process that outputs weekly payroll batches across the server. I want to save a copy of the batch on the User Server before outputting to the Head Office Server. Tested at home, unnetworked ChDrive and ChDir works perfectly. The Server is Windows Server 2008 R2 with SP1 and I have changed the path to use UNC, but the code fails at the first ChDir?
I have tried MyPath, ChDrive and ChDir and I can't get anything to work... any ideas would be very much appreciated.
Thanks
M
I have a process that outputs weekly payroll batches across the server. I want to save a copy of the batch on the User Server before outputting to the Head Office Server. Tested at home, unnetworked ChDrive and ChDir works perfectly. The Server is Windows Server 2008 R2 with SP1 and I have changed the path to use UNC, but the code fails at the first ChDir?
Code:
Function PAYROLLREP()
On Error GoTo PAYROLLREP_Err
Call SetPortrait("PAYROLL REPORT", False)
DoCmd.CLOSE acReport, "PAYROLL REPORT"
MsgBox "First Create a Copy of the Batch on the Local Drive in C:\CopyPR", vbInformation, ""
ChDir "\\npfs5\Branches\Truro\CopyPR\"
DoCmd.OutputTo acQuery, "NP_WKB", "MicrosoftExcel(*.xls)", "", False, ""
MsgBox "Now send the Payroll Batch to the Head Office", vbInformation, ""
ChDir "\\NPFS2\PAYROLL"
DoCmd.OutputTo acQuery, "NP_WKB", "MicrosoftExcel(*.xls)", "", False, ""
DoCmd.Hourglass True
DoCmd.RunMacro "REC TO TRAN", , ""
DoCmd.OutputTo acReport, "PAYROLL REPORT", "RichTextFormat(*.rtf)", "", False, "", 0
DoCmd.Hourglass True
DoCmd.RunMacro "Plus Points Update Macro", , ""
DoCmd.OpenReport "PAYROLL REPORT", acViewPreview, "", ""
DoCmd.Hourglass False
DoCmd.CLOSE acForm, "Process Payroll Warning"
DoCmd.SetWarnings False
PAYROLLREP_Exit:
Exit Function
PAYROLLREP_Err:
MsgBox Error$
Resume PAYROLLREP_Exit
End Function
Thanks
M
Comment