Importing of text file not using transfer type in import spec

A

Andy Hull

Hi

I am importing different types of files, some are delimited and some are
fixed width.

I have set up appropriate import spces for each type and have a table with
the import spec names in.

The users can select which files to import and choose the "type" (eg
invoices) which in turn defines which import spec will be used.

The code I use to perform the import is...

DoCmd.TransferText , _
DLookup("import_specification_name",
"tbl_import_file_types", _
"import_file_type_pk = " & .Fields!import_file_type_fk), _
DLookup("database_table_name", "tbl_import_file_types", _
"import_file_type_pk = " & .Fields!import_file_type_fk), _
folder_and_filename, -1

Note that the first parameter (AcTextTransferType) is left blank as this is
set up in each import spec and will be AcImportFixed or AcImportDelim
depending on the import spec.

However, it seems that by leaving it blank, Access defaults to AcImportDelim
and then cuts the fixed width files wherever there is a comma.

If I set explicitly set it to AcImportFixed the fixed width files work but
the delimited files fail.

It appears that Access uses the parameter specified in the code over riding
what is set in the import spec - and even does this when left blank (over
riding the spec with the default of AcImportDelim).

Has anyone else experienced this and can you help?

Regards

Andy Hull
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top