Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / March 2008

Tip: Looking for answers? Try searching our database.

filecopy maximum characters...?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
sbradley0@gmail.com - 19 Mar 2008 20:27 GMT
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

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.