filecopy maximum characters...?

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
 
D

Douglas J. Steele

Are you sure there aren't any special characters in the value being returned
by the recordset?
 
A

Albert D. Kallal

46 chars seems quite close to the *default* field length size of 50
chars.....

I would check your max length in your table def.....
 
S

sbradley0

Are you sure there aren't any special characters in the value being returned
by the recordset?

--
Doug Steele, Microsoft Access MVPhttp://I.Am/DougSteele
(no private e-mails, please)














- Show quoted text -

There are definitely no special characters... or rather, one name had
a special character and I had to debug. But every file that was moved
before that was cut off at 46 char.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top