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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

importing a .csv file to access 2000

Status
Not open for further replies.

woodje

Technical User
May 24, 2004
16
US
Hello,
I need a little help here. I am using access 2000 and I am importing several .csv files to tables. The problem is that I am receiving about 14 files a day. The users sending these files to me are sending the file with a file name of "ca.dypdmrg.20041027.csv" and whenever I try to import the files the database cannot find the file. However if I change the file to take out the "." and replace it with "_" then the system will pick up the file. Can anyone think of a way I can import the file with the "."? Or of a way I can change the file names to replace the "." with a "_"? Any help you can give me will be greatly appreciate.


Jeff
 
Something like this ?
oldpathname = "ca.dypdmrg.20041027.csv"
newpathname = Replace(Left(oldpathname, Len(oldpathname) - 4), ".", "_") & ".csv"
Name oldpathname As newpathname

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
PH,
Thanks for the help. I can see where that would work. However I am having am having problem figuring out where I should place it in my exsisting code. I have included that code below.

Dim cFILENAME As String
Dim cPath As String
Dim cFile As String

cPath = "F:\GA ATL Fraud\GP_Data_Imports\"
cFile = Dir(sPath & "ca_dypdmrg*.csv")
cFILENAME = cPath & cFile


Dim C_OLD_PATH, C_OLD_FILE, C_OLD_FILENAME, C_NEW_PATH, C_NEW_FILE, C_NEW_FILENAME
C_OLD_PATH = "F:\GA ATL Fraud\GP_Data_Imports\"
C_OLD_FILE = Dir(C_OLD_PATH & "ca_dypdmrg*.csv")
C_OLD_FILENAME = C_OLD_PATH & C_OLD_FILE
C_NEW_PATH = "F:\GA ATL Fraud\GP_Data_Imports\GP_CAR_Data_Import_Completed\"
Do Until C_OLD_FILE = ""
C_NEW_FILE = C_OLD_FILE & "_done"
C_NEW_FILENAME = C_NEW_PATH & C_NEW_FILE
C_OLD_FILE = Dir
Name C_OLD_FILENAME As C_NEW_FILENAME
C_OLD_FILENAME = C_OLD_PATH & C_OLD_FILE
Loop

DoCmd.SetWarnings True
Beep
MsgBox "Update Completed!!!", vbInformation, "Data Upload
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top