Linked Excel Table Field Name Issue

User avatar
Abraxus
3StarLounger
Posts: 254
Joined: 01 Mar 2010, 17:34
Location: Blue Springs, MO

Linked Excel Table Field Name Issue

Post by Abraxus »

A coworker ran into something interesting and I'm seeing if anyone has a solution.

He has several tables that are links to Excel files.

In the tables were field names with a pound (#) sign. (Book #, for example)

When attempting to link the tables in a query using those fields, he gets an error about not finding that field.

Is there a way to link tables with that pound sign in the field name, or will the field need to be renamed?

Thanks!
Morgan

User avatar
HansV
Administrator
Posts: 78620
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Linked Excel Table Field Name Issue

Post by HansV »

If he refers to the field as [Book #] it should work as far as I know.
But it's much better to avoid spaces and unusual characters in column headers (field names) in Excel if one intends to import or link the data into Access. It'll save a lot of hassle.
So I would recommend renaming the column.
Best wishes,
Hans

User avatar
Abraxus
3StarLounger
Posts: 254
Joined: 01 Mar 2010, 17:34
Location: Blue Springs, MO

Re: Linked Excel Table Field Name Issue

Post by Abraxus »

In the Relationships builder, it won't let you modify the field name to add the brackets.

In a query builder, it didn't object to the pound sign in the field name.

Just an Access oddity, I suppose...
Morgan

User avatar
Wendell
4StarLounger
Posts: 482
Joined: 24 Jan 2010, 15:02
Location: Colorado, USA

Re: Linked Excel Table Field Name Issue

Post by Wendell »

I think the issue involves the "space" between the K and the # as well - see this rather old article on the subject - https://support.microsoft.com/en-us/hel ... -databases. Bottom line is to rename the column in Excel, or import the table and then rename it in Access.
Wendell
You can't see the view if you don't climb the mountain!

CData
3StarLounger
Posts: 308
Joined: 24 Dec 2015, 16:41

Re: Linked Excel Table Field Name Issue

Post by CData »

Rather than work directly with the linked excel; instead make a query of that excel which includes all fields. Then alias the field name i.e.
BookNumber: Book #

Then work instead with this query for whatever you need to do rather than the excel table itself.