Access 2000 changing field names

A

Abay

I am importing an excel files into Access, and the import procedure does not
give an option to define the field names of the data being input (doesn't
give the option to set up a template like it does with .txt data), it either
takes the field names from the first line in the excel file or allocates
generic field names such as field1, field2 etc.

My problem is that I need to add the data to an already defined table, say
Log, & I need for field1 to become Cname, so I can append the excel file to
the Log table (which has the Cname already defined). Can't change the
field names in the log table as I have too many queries, procs etc. defined
with the log fields.

Hope this makes sense .. any help would be very much appreciated.

Abay
 
D

Douglas J. Steele

Option 1 is to create a query on your imported table that aliases all of the
field names, and use the query wherever you would otherwise have used the
table.

Option 2 is to rename your existing fields using one of the following
utilities:
Find & Replace: http://www.rickworld.com/products.html
Speed Ferret: http://www.moshannon.com/speedferret.html
Ucora's: http://www3.bc.sympatico.ca/starthere/findandreplace/

My vote is option 1, since meaningful field names is always better than
Field1, Field2!
 
A

Abay

Many thanks for your suggestions & I agree that option 1 is the way to go.
I love using Access but am pretty much a newbie only getting to use it now
and then, so the alias thing is pretty new to me.

I looked up the help info within access, and went with what I thought might
work. I tried to create aliases of all the field names without success. I
can only create an alias at the table name level as far as I can see, & I
can't get that to work for me.

I thought the best way would be to append the result of the excel import to
the table (with correct field names), but can't seem to do that right. In
query design mode I right mouse click on any field in the logx table (see
below) and the only option is to give an alias name to the table and not
field by field. The tables I am using are as follows:

logs .. the destination table with the correct field names
logx .. the result of the excel import
log_tem .. blank template table with correct field names

The resulting sql code is as follows:

INSERT INTO logs
SELECT logx.*
FROM logs_tem AS logx;

The result of this is, logs_tem is appended to logs (as is obvious from the
code), what I need is logx to be appended, and am really stumped as to how
to do this.

Is it at all possible?

Any help again would be much appreciated.

Abay
 

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