Ms access changing field name in query

lwarren1968

Registered User.
Local time
Today, 06:54
Joined
Jan 18, 2013
Messages
78
FIELD NAME is "B"
Need to change it to "option:value", however the colon is causing a invalid syntex error?

option:value:B
 
Untested but try

[option:value]:B
 
Please tell us more.

You can alias a field in a query

Code:
Select fld1, fld2 [COLOR="DarkOrange"]as MyCustomName[/COLOR] from MyTable

as MyCustomName represents an alias in the SQL of the query.

Access does not like special characters in field names. Use alpha and numerics and underscore "_" only.
Hope it helps.
 
Last edited:
the fleld B needs to reflect option:value

SELECT SW_LABEL_VALUE_UNION_QRY.A AS attribute_code, SW_LABEL_VALUE_UNION_QRY.B AS optionvalue
FROM SW_LABEL_VALUE_UNION_QRY;
 
Try

"Silly:Name": B

It really doesn't like using the : and I'm certain it will trip you up later in the project.
IMVHO
 
quotation marks are present in the field name when using

returns "Silly:Name"
 
If you are outputting this in a report or export query you can use the caption property if that would help.

The : is an illegal character as far as access (and SQL and almost any other dbms) is concerned, so I can't think of any way around it.
 
ok, if adding [] in the sql its self then it works.

SELECT SW_LABEL_VALUE_UNION_QRY.A AS attribute_code, SW_LABEL_VALUE_UNION_QRY.B AS [option:value]
FROM SW_LABEL_VALUE_UNION_QRY;

Thank all for helping!
 

Users who are viewing this thread

Back
Top Bottom