Headache with # in field name

eddy

Registered User.
Local time
Today, 11:31
Joined
Nov 30, 2005
Messages
23
I have a problem. One of the fields in my table is called item#. I am opening a recordset and using item_ as the field name in the sql statement but it keeps failing because of it. Does anyone know how to fix it? Or can it be fixed at all?

The sql statement was very simple. SELECT item_ FROM Products;

Please help.
 
Surround the field name in barackets[Field]
 
That didn't work either. I've tried with table name in front also. I'm totally at a loss on this.
 
can you post your code? What error do you get?
 
Why are you using an underscore if the actual name contains #? It would be:

SELECT [item#] ...
 
Sorry guys, you are right, it should be with a [] around a name without the _ but the # instead. I really don't know why I was using the underscore. Long day :(

Thanks for the help all.
 
I'd like to note that if you have the capability, I'd just rename the field to not use any special characters.

Keep in mind that you can use Caption property if you want to display "#" or any other special character to your users on any new forms using the field.
 
I'd like to note that if you have the capability, I'd just rename the field to not use any special characters.

Keep in mind that you can use Caption property if you want to display "#" or any other special character to your users on any new forms using the field.

I second this -

Get rid of special characters and spaces in your field names and object names and life will become MUCH easier.
 

Users who are viewing this thread

Back
Top Bottom