S
sbradley0
Hi,
I have some code that copies a set of files from one place to another
and renames them, which is great.
Unfortunately, the string for the destination path/file name seems to
have a maximum of 46 characters. The code captures the full path, but
the when it writes the file name, it's stuck on 46 characters.
---
Private Sub btnRenameFiles_Click()
Dim rstAny As DAO.Recordset
Dim dbAny As DAO.Database
Dim strFrom As String
Dim strTo As String
Dim stDocName As String
stDocName = "qryReportsMe"
DoCmd.OpenQuery stDocName
Set dbAny = CurrentDb()
Set rstAny = dbAny.OpenRecordset("SELECT DISTINCT woindex,
worepname, wofile FROM tblReportsMe")
While Not rstAny.EOF
strFrom = rstAny!wofile
strTo = "C:\Month End Reports\" & rstAny!worepname & ".txt"
FileCopy strFrom, strTo
rstAny.MoveNext
Wend
End Sub
I have some code that copies a set of files from one place to another
and renames them, which is great.
Unfortunately, the string for the destination path/file name seems to
have a maximum of 46 characters. The code captures the full path, but
the when it writes the file name, it's stuck on 46 characters.
---
Private Sub btnRenameFiles_Click()
Dim rstAny As DAO.Recordset
Dim dbAny As DAO.Database
Dim strFrom As String
Dim strTo As String
Dim stDocName As String
stDocName = "qryReportsMe"
DoCmd.OpenQuery stDocName
Set dbAny = CurrentDb()
Set rstAny = dbAny.OpenRecordset("SELECT DISTINCT woindex,
worepname, wofile FROM tblReportsMe")
While Not rstAny.EOF
strFrom = rstAny!wofile
strTo = "C:\Month End Reports\" & rstAny!worepname & ".txt"
FileCopy strFrom, strTo
rstAny.MoveNext
Wend
End Sub