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
---
Is there anything I can do to get around this?
Thanks.
Douglas J. Steele - 19 Mar 2008 21:38 GMT
Are you sure there aren't any special characters in the value being returned
by the recordset?

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
> Hi,
>
[quoted text clipped - 32 lines]
>
> Thanks.
sbradley0 - 19 Mar 2008 22:13 GMT
On Mar 19, 4:38 pm, "Douglas J. Steele"
<NOSPAM_djsteele@NOSPAM_canada.com> wrote:
> Are you sure there aren't any special characters in the value being returned
> by the recordset?
[quoted text clipped - 45 lines]
>
> - 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.
Albert D. Kallal - 19 Mar 2008 22:05 GMT
46 chars seems quite close to the *default* field length size of 50
chars.....
I would check your max length in your table def.....

Signature
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pleaseNOOSpamKallal@msn.com