Field Names into a table

E

Emilio

Is there a way to import the field names of a file (csv file, should be first
row) into a table?
If this is not possible, I import a file into a table, can I get the field
names (header) from this table and make a table with just field names in one
column.
Thanks!!
 
V

Van T. Dinh

That's is the normal behaviour. When you use File / Get External Data ... /
Import ..., the Wizard gives you different options and one of the options is
"1st Row contains Column Names" (or something similar).

However, some Column Names may not be suitable for use as Access Field
Names.
 
E

Emilio

You import the data this way but not the field names (header). As an example
here is what I want to do:

a file would look like this:

loan Number, Due Date, Principal Balance, Note Rate
10000111, 20050507, 251,200.50, .0655

It needs to end up in a table like this:

[FieldNames]
loan Number
Due Date
Principal Balance
Note Rate

Don't need the data just field names.
 
V

Van T. Dinh

OK ... I see what you are trying to do but not sure why.

You can import and then create a TableDef then you can retrieve the Field
Names from the TableDef of the imported file to create the tblFieldNames you
want.

Alternatively, you can use code to read the first line of your Text file and
then parse the first line read into Field names for your destination Table.

Check Access VB Help on TableDef and ReadLine Method of the TextStream
Object.
 
Top