T
TerryC
Thanks very much for any help
Hi All,
I have a need to import tab delimited text files into my DB (first row has
field names).
The files are similar in layout BUT not the same (unfortunately).
I can set up an import spec for a specific layout and all works fine.
Linking to the text file without a spec doesn't seem to be any better.
What I want is a way to map the fields I want in the text file to my table
fields.
The text file field names (I am interested in) are consistent but not always
in the same column. Is there are way to iterate through the first text file
row and build an import spec using VBA?
Importing without defining a spec bombs out as Access defaults to comma
seperated. And even if I overcome that I really want to import all fields as
text and preserve the leading zero(s) in some fields.
eg.
One text file will look like:
Sort Order*
Name
address1
address2
Locality
State
Postcode*
ppsp *
ppsp code*
And another will look like:
Sort Order*
title
first name
last name
position
company
address1
address2
address3
Locality
state
postcode*
phone
email
ppsp*
ppsp code*
The fields with * are the only fields I really want and they will be in all
varieties of the text files.
Any suggestions on getting these into my mdb either straight in or via a
temp table or something would be greatly appreciated.
Getting things changed at text file generation end is not an option -
unfortunately.
Thanks very much for reading and for any assistance.
Terry
Hi All,
I have a need to import tab delimited text files into my DB (first row has
field names).
The files are similar in layout BUT not the same (unfortunately).
I can set up an import spec for a specific layout and all works fine.
Linking to the text file without a spec doesn't seem to be any better.
What I want is a way to map the fields I want in the text file to my table
fields.
The text file field names (I am interested in) are consistent but not always
in the same column. Is there are way to iterate through the first text file
row and build an import spec using VBA?
Importing without defining a spec bombs out as Access defaults to comma
seperated. And even if I overcome that I really want to import all fields as
text and preserve the leading zero(s) in some fields.
eg.
One text file will look like:
Sort Order*
Name
address1
address2
Locality
State
Postcode*
ppsp *
ppsp code*
And another will look like:
Sort Order*
title
first name
last name
position
company
address1
address2
address3
Locality
state
postcode*
phone
ppsp*
ppsp code*
The fields with * are the only fields I really want and they will be in all
varieties of the text files.
Any suggestions on getting these into my mdb either straight in or via a
temp table or something would be greatly appreciated.
Getting things changed at text file generation end is not an option -
unfortunately.
Thanks very much for reading and for any assistance.
Terry