Hello.
The following command in an older version of Access used to work:
RetVal = Shell("cmd /c copy /y C:\users\abc\desktop\output.xls C:\users\abc\desktop\split files" & txtDist & ".xls", vbHide)
Copy an output file from access which is working and then moves it to the split file folder and renames it with the variable with .xls.
I am now using Access 2013. I do not get any errors, the script runs, the template (output.xls) gets populated but again, it doesn't copy.
Any suggestions would be great. Below is the entire script.
Additionally, do any references in VB need to be added since I moved this script to 2013?
---
Private Sub Command0_Click()
DoCmd.SetWarnings 0
Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim rs As DAO.Recordset
Dim db As DAO.Database
Set db = CurrentDb
Set rs = db.OpenRecordset("Distributor-IDs", dbOpenTable)
rs.MoveFirst
Do Until rs.EOF
txtDist = rs![APR]
'Set objFolder = objFSO.CreateFolder("C:\users\abc\desktop\Split Files" & txtDist)
DoCmd.OpenQuery "xyz-Output", , acReadOnly
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel8, "xyzoutput", "C:\users\abc\desktop\output.xls", True
RetVal = Shell("cmd /c copy /y C:\users\abc\desktop\output.xls C:\users\abc\desktop\split files" & txtDist & ".xls", vbHide)
rs.MoveNext
Sleep (20000)
Loop
DoCmd.SetWarnings -1
End Sub
The following command in an older version of Access used to work:
RetVal = Shell("cmd /c copy /y C:\users\abc\desktop\output.xls C:\users\abc\desktop\split files" & txtDist & ".xls", vbHide)
Copy an output file from access which is working and then moves it to the split file folder and renames it with the variable with .xls.
I am now using Access 2013. I do not get any errors, the script runs, the template (output.xls) gets populated but again, it doesn't copy.
Any suggestions would be great. Below is the entire script.
Additionally, do any references in VB need to be added since I moved this script to 2013?
---
Private Sub Command0_Click()
DoCmd.SetWarnings 0
Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim rs As DAO.Recordset
Dim db As DAO.Database
Set db = CurrentDb
Set rs = db.OpenRecordset("Distributor-IDs", dbOpenTable)
rs.MoveFirst
Do Until rs.EOF
txtDist = rs![APR]
'Set objFolder = objFSO.CreateFolder("C:\users\abc\desktop\Split Files" & txtDist)
DoCmd.OpenQuery "xyz-Output", , acReadOnly
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel8, "xyzoutput", "C:\users\abc\desktop\output.xls", True
RetVal = Shell("cmd /c copy /y C:\users\abc\desktop\output.xls C:\users\abc\desktop\split files" & txtDist & ".xls", vbHide)
rs.MoveNext
Sleep (20000)
Loop
DoCmd.SetWarnings -1
End Sub