The Problem The other day I ran into a problem with DoCmd.TransferText: it will not accept text files having longer names that 64 characters. Possibly, because 64 characters is the maximum length of an object name in Access. You will get an error message: So I tried to find a work around. My Work Around First, I created a table in Access to store information about the text files, in this particular case, CSV files. The I created a VBA script which actually store the information in the table strMapCSV = CurrentProject.Path & "\" Set fs = CreateObject("Scripting.FileSystemObject") Set f = fs.GetFolder(strMapCSV) For Each f1 In f.files If Right(f1.Name, 3) = "csv" And Left(f1.Name, 4) <> "file" Then strSQL = "insert into tblCSVfiles (CSVname, CSVsize,CSVdate,CSValias) " strSQL = strSQL & " VALUES ('" & Replace(f1.Name, "'", "`") & ...
Blog over software als Access, Excel, SQL, Crystal Reports, Report Builder, Word, VBA, elfstedentochten en andere regionale zaken.