Selasa, 04 Januari 2022

Re: [MSAccessProfessionals] DoCmd.Transfer Import Specification

Answering my own question!

If you run through the process of importing a file, when you get to the part where you define which columns and what format to use, click the advanced button at the bottom. On the form that pops up you will see "Save As" and "Open" buttons. This is where you save the import specification when complete and not at the "Save these steps prompt" at the end of the import.

Sean


On Tuesday, January 4, 2022, 12:23:31 PM CST, Sean Cooper via groups.io <smcjb=yahoo.com@groups.io> wrote:


Happy New Year All.

I have a MS Access Macro that calls a VBA Module that has the following line of code for importing a text.csv file.

DoCmd.TransferText acImportDelim , "IMPORT_201223", TTFillsTableName, TTSourceFilePath, True

This works as designed. 

My understanding is that 
- "IMPORT_201223" is the import template (the CSV file has about 30 columns but only a dozen or so are imported)
and can confirm that
- TTFillsTableName is the name of the table that the file is imported into
- TTSourceFilePath is the source location of the CSV file being imported and
- True tells Access that the file has Field Names.

I want to change the import template (add additional columns to import) but if I go to the "External Data" tab, and look under "Saved Imports" I do not see this template. If I create and save a new import and then change the code above it gives me a 3625 run time error and tells me it can't find the newly defined text file specification, even though I can see that under the save imports tab.

Any suggestions?

Thanks as always

Sean


Tidak ada komentar:

Posting Komentar