By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,482 Members | 2,438 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,482 IT Pros & Developers. It's quick & easy.

Link to Text with Unknown Headers

P: 72
Hello,

Is there a way to setup an Import/LinkTable specification to import/link a delimited text file regardless of the headers in the file, but still retain the header names?

I've got multiple incoming files that are text files, but delimited by differing things (e.g. tabs, commas, pipes, etc.). Some of the data in these files needs to be standardised and output in a common file format.

The headers themselves will be called the same things, but quite which headers will or will not be present in any given file varies.

I wanted to have a simple import spec for each delimiter, so that for each file I get, I simply tell the database which one to use, and set it going. It could then link the file, test the resulting linked table for which fields are present, and copy the relevant ones into a standard table that can then be used to export out from.

Unfortunately, the specs seem to require a list of fields to map to. Can a spec be created that just parses a file based on its delimiter, using the first row for headers, but not paying attention to what those headers are?

Regards,
Rob.
Jun 8 '08 #1
Share this Question
Share on Google+
3 Replies


ADezii
Expert 5K+
P: 8,597
Have you tried using the TransferText() Method? The 2nd Argument is the Specification Name, and the 5th Argument is a Boolean Value indicating whether or not the 1st Row consists of Field Names. The general syntax is listed below:

Expand|Select|Wrap|Line Numbers
  1. expression.TransferText(TransferType, SpecificationName, TableName, FileName, HasFieldNames, HTMLTableName, CodePage)
Example:
Expand|Select|Wrap|Line Numbers
  1. DoCmd.TransferText(acImportDelim, "Your Specification Name", "Table Name ti Import to, Absolute Path to Text File, 1st Row Has Field Names? (-1 or 0), HTMLTableName, CodePage)
Jun 8 '08 #2

P: 72
Have you tried using the TransferText() Method? The 2nd Argument is the Specification Name, and the 5th Argument is a Boolean Value indicating whether or not the 1st Row consists of Field Names. The general syntax is listed below:

Expand|Select|Wrap|Line Numbers
  1. expression.TransferText(TransferType, SpecificationName, TableName, FileName, HasFieldNames, HTMLTableName, CodePage)
Example:
Expand|Select|Wrap|Line Numbers
  1. DoCmd.TransferText(acImportDelim, "Your Specification Name", "Table Name ti Import to, Absolute Path to Text File, 1st Row Has Field Names? (-1 or 0), HTMLTableName, CodePage)
That's what I was using. Unfortunately, the problem is the specification itself.

You can specify the specification, and I was going to do this to pick the relevent spec for the file type.

Unfortunately, I could not set up the spec to ignore the names of the headers. If you set up a spec, it then requires all files you use that with to have the same headers as well. If not, it simply takes the columns in your new file as though they were the same.

I need the spec to save with only the fact that it is a delimited file, regardless of the headers themselves.
Jun 8 '08 #3

ADezii
Expert 5K+
P: 8,597
That's what I was using. Unfortunately, the problem is the specification itself.

You can specify the specification, and I was going to do this to pick the relevent spec for the file type.

Unfortunately, I could not set up the spec to ignore the names of the headers. If you set up a spec, it then requires all files you use that with to have the same headers as well. If not, it simply takes the columns in your new file as though they were the same.

I need the spec to save with only the fact that it is a delimited file, regardless of the headers themselves.
I guess you could always resort to basic, low level, I/O Functions to bring the delimited file in.
Jun 9 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.