chris-uk-lad
07-18-2008, 01:05 AM
Hi all,
I cant seem to pick out the problem with this dispite trawling various forums.
DoCmd.TransferText acImportDelim, "tblInterfaceMain", strFilename, True
where strfilename is the file being imported, and tblInterfaceMain is an existing table within the access database.
I get the RT error 7871
The table name you entered doesnt follow MS Access object naming rules.
Many Thanks
namliam
07-18-2008, 01:10 AM
From the Access help:
TransferText(TransferType, SpecificationName, TableName, FileName, HasFieldNames, HTMLTableName, CodePage)
You skipped the import specification name, as a result the Filename is beeing used a the table name, which is invalid.
chris-uk-lad
07-18-2008, 01:31 AM
i before used TransferTextDelimited as the spec but it was calling it as a variable and id read somewhere that with the spec left alone it would use a default based on import/export.
Used "Import" as the spec and worked but now the delimited file i imported has all the columns placed in one column :(
chris-uk-lad
07-18-2008, 01:43 AM
Ignore that, Import in the import spec only worked the first time, now says variable not declared :x
namliam
07-18-2008, 01:57 AM
You have to create a Specification first... Import the file by hand as it should be done the just before actually importing click the "Save" button and give it a usefull name.
Then use that specification you just saved in your Transfertext command. This is the only way to guarantee that it will work, allowing access or any peace of software to think on its own (i.e. use default) is dangerous!
chris-uk-lad
07-18-2008, 06:26 AM
is the spec stored locally? cause i plan on having this tool opened on other computers?
namliam
07-18-2008, 06:29 AM
Localy... If you mean that on your computer... Then NO...
The specification is stored within the DB.
chris-uk-lad
07-21-2008, 12:16 AM
all sorted, thanks :)
Now how would i export it back out as a text document? (used the code to amalgamate several txt docs)
namliam
07-21-2008, 01:19 AM
Uhm, you mean you now want to export data to a text file??
The basic is the same...
DoCmd.TransferText acExportDelim, etc....