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

Can I do this with TransferText and a Schema.ini File?

Status
Not open for further replies.

KellyStee

Technical User
Jul 30, 2001
106
US
I'm trying to import a text file using a schema.ini file. Is this the best way to do it? Everything works except it takes out the "\" characters of my path for my schema.ini and tells me the file does not exist. I even tried using chr(92) and that doesn't work either. Any help would be greatly appreciated!!

My code so far is:

DoCmd.TransferText acImportDelim, "C:\TestData\Schema.ini", "Imported Data", glFileName
 
Leave the Schema.ini path out of the string. The TransferText looks for it automatically in the same directory as the file to be imported.

DoCmd.TransferText acImportDelim, ,"Imported Data", glFileName Anthony J. DeSalvo
President - ScottTech Software
"Integrating Technology with Business"
 
ajdesalvo,
It will import the file when I take out the schema.ini file string, but it doesn's seem to be using the schema.ini file to import. It just imports all values into one field (the file is delimited). I should be able to import a delimited file with a schema.ini file, right??? When I read some info on msdn.com about transfertext, the article mentioned that if you had a delimited file and you left the specificationname space blank, it would use the default??

Thanks for the quick response!
Kelly
 
Actually, I figured out the answer to my own question because it was driving me nuts!! :eek:) It seems using a schema.ini file with the TransferText method is a known bug. Instead, Microsoft recommends using SQL:
Db.Execute "SELECT * INTO [Table Name] FROM [TEXT;DATABASE=[Path].[Filename]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top