I cannot select a column if it has a space.
------------------------------------------------------------------------------------------
For example, i have a table:
Short name Code Year_Produced
ABA 1001 2005
BBB 1544 2001
CCC 1002 2000
------------------------------------------------------------------------------------------
I cannot select "short name" because there's a space in between
While i can select "Year_Produced" , because there's underscore("_") in
between.
------------------------------------------------------------------------------------------
How can I write an SQL to select name with space in between. Using quote ?
How ?
please kindly show me an example !
thank you , expert !!
In Access SQL you use square brackets if the column name has a space, is a
reserved word, or uses characters other than the Underscore, Letters, and
numbers.
SELECT [Short Name], Code, Year_Produced, [22], [Time], [All-Source]
FROM SomeTable
Explanation of why brackets.
Short Name has a space
22 is all numbers
Time is a reserved word (current system time)
All-Source is hyphenated and would be seen as a math expression (subtract
column "Source" from column "All") and ALL is a reserved word also.

Signature
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
.
>I cannot select a column if it has a space.
>
[quoted text clipped - 20 lines]
>
> thank you , expert !!
ali - 30 Oct 2007 03:51 GMT
Perfect explaination, Straight to the answer . Thank you !

Signature
Allen Phailat Wongakanit
> In Access SQL you use square brackets if the column name has a space, is a
> reserved word, or uses characters other than the Underscore, Letters, and
[quoted text clipped - 33 lines]
> >
> > thank you , expert !!
Tagory Torres - 08 Nov 2007 16:32 GMT
Guys,
I tried to use this, but it's not work with character "?"! Is there a solution to this problem?
I can't change the column name.
EggHeadCafe - .NET Developer Portal of Choice
http://www.eggheadcafe.com
John Spencer - 08 Nov 2007 16:52 GMT
Can you be clearer? What is the field name (column name) that you can't
specify?
Normally if the field name contains characters other than letters, numbers,
and underscores, then you refer to the field as bracket Field Name bracket
and to fully refer the name you use bracket table name bracket dot bracket
field name bracket.
[Some Table #].[Some field?]
Or in some cases (only one table in a query)
[Some field?]

Signature
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
.
> Guys,
>
[quoted text clipped - 5 lines]
> EggHeadCafe - .NET Developer Portal of Choice
> http://www.eggheadcafe.com
My advise, never put spaces in the names of anything in Access. If you feel
you need the space for readability, use an _ to separate words. You can
select the field by wrapping it in brackets.
SELECT [Short name], Code, Year_Produced
FROM yourTable
HTH
Dale

Signature
Don''t forget to rate the post if it was helpful!
Email address is not valid.
Please reply to newsgroup only.
> I cannot select a column if it has a space.
>
[quoted text clipped - 20 lines]
>
> thank you , expert !!
Select [Short name] from [Your Table]
> I cannot select a column if it has a space.
>
[quoted text clipped - 23 lines]
> --
> Allen Phailat Wongakanit