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 / Importing / Linking / October 2007

Tip: Looking for answers? Try searching our database.

Change File Extension before importing

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
John W - 31 Oct 2007 14:54 GMT
I've created a database that will take large quantities of delimited text
files and import them to Access.  Everything is working fine but I'm
wondering if there's some code that would change the file extension before
importing?  The files are all text but they come to us with a .dpr
extension.  If it were just a few files it would be no problem to just
change them manually, but I'm dealing with hundreds of files per week.  Is
this possible to do?

Thanks!
Klatuu - 31 Oct 2007 15:36 GMT
Assuming all the files are in the same folder, you can use a combination of
the Dir function and the Replace function to rename all the files that end
with .dpr.

Dim strOldName as String
Dim strNewName as String
Dirm strFullName As String
Const conPath as String = "C:\SomeFolder\"

   strFileName = Dir(conPath & "\*.dpr")
   Do Until Len(strFileName) = 0
       strOldName = conPath & strFileName
       strNewName = Replace(strOldName,".dpr", ".txt")
       Name strOldName As strNewName
       strFileName = Dir
   Loop
Signature

Dave Hargis, Microsoft Access MVP

> I've created a database that will take large quantities of delimited text
> files and import them to Access.  Everything is working fine but I'm
[quoted text clipped - 5 lines]
>
> Thanks!
John W - 31 Oct 2007 16:07 GMT
This worked perfectly....Thanks for the help!

> Assuming all the files are in the same folder, you can use a combination
> of
[quoted text clipped - 25 lines]
>>
>> Thanks!
 
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.