Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Promblem importing file with a Time stamp extentsion

Status
Not open for further replies.

GooGoocluster

Technical User
May 12, 2005
71
US
I am trying to import a text based semi colon delimted file that the file name looks just like this.

Acc_Export_01_26_2006_12.45.36

Is this even possible? I cant change the format of the file that I am trying to import.

If I add the extention .36 to the registry it still have problems I think it is the multiple periods in the file name that makes access fail.

Any way thanks in advance to whoever can fix this
 
The easiest thing might be to rename the file and then import:
[tt]Name "Acc_Export_01_26_2006_12.45.36" As "accimp.txt"[/tt]
Would this suit?
 
that could work is it possible to do that to all the files in a directory? like what steps would I need to do to have this happen.

Like :
/Code
For each (file in dir)
Name "Acc_Export_01_26_2006_12.45.36" As "accimp.txt"
Transfertext accimp.txt,blah,blah
Kill accimp.txt
Next

/code


Somthing like this?
 
Here is an example. Since it uses the native functions available in Access I had to use the [tt]FileCopy/Kill[/tt] trick to acheive the rename.
If you wanted to play around with the [tt]FileSystemObject[/tt] it does have a [tt]Rename()[/tt] method.
Code:
Public Sub ChangeExtension(Directory As String)
On Error GoTo ErrorHandler
Dim strFile As String
strFile = Dir(Directory)
Do
   FileCopy strFile, strFile & ".txt"
   Kill strFile
   strFile = Dir
Loop Until Len(strFile) = 0
ErrorHandler:
If Err.Number = 75 Then
   MsgBox "Directory not found.", vbOKOnly, "Change Extension Error"
End If
End Sub

Hope this helps,
CMP

Funny thing about being unemployed, weekends don't mean quite so much, just means you get to hang out with your working friends. Primus
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top