Querying using SQL statement

J

Joe

Hi

Using an expression as follows...

SELECT IDCustomer AS Code, Name, Address FROM Customers

....the AS clause doesn't work in Access 2007.

Running the query, the column caption remains IDCustomer.

What is the problem? Why this happens?

Is there any solution (except back to 2003)?

Thanks in advance for your help.

Joe
 
J

John W. Vinson

Hi

Using an expression as follows...

SELECT IDCustomer AS Code, Name, Address FROM Customers

...the AS clause doesn't work in Access 2007.

Running the query, the column caption remains IDCustomer.

What is the problem? Why this happens?

Is there any solution (except back to 2003)?

Thanks in advance for your help.

Joe
This is probably another reserved name. 2007 is much pickier about using
reserved words (Code, Date, Order, etc.) as fieldnames.

Does it work if you use AS CustomerCode? Or you might try

AS
Code:
 
J

Joe

Hi John

The name Code was just an example.

Anything I type, a regular text or even a name - Robert - for example, it
doesn't work.

I'm using a Access 2007 in Brazilian-portuguese version.

This customized version could be the problem? In positive case, is there a
solution?

Thanks in advance for your time and answer.

Joe






John W. Vinson said:
Hi

Using an expression as follows...

SELECT IDCustomer AS Code, Name, Address FROM Customers

...the AS clause doesn't work in Access 2007.

Running the query, the column caption remains IDCustomer.

What is the problem? Why this happens?

Is there any solution (except back to 2003)?

Thanks in advance for your help.

Joe
This is probably another reserved name. 2007 is much pickier about using
reserved words (Code, Date, Order, etc.) as fieldnames.

Does it work if you use AS CustomerCode? Or you might try

AS
Code:
[/QUOTE]
 
J

John W. Vinson

Hi John

The name Code was just an example.

Anything I type, a regular text or even a name - Robert - for example, it
doesn't work.

I'm using a Access 2007 in Brazilian-portuguese version.

This customized version could be the problem? In positive case, is there a
solution?

Thanks in advance for your time and answer.

Odd! I have a database with a ton of queries, many of which use aliases, and
they work fine in 2007.

Try leaving out the keyword AS - it's optional in at least some contexts.

Perhaps you could post the actual complete SQL that's giving you the error.
 
D

Duane Hookom

Do you have a Caption property defined in the table design?

--
Duane Hookom
Microsoft Access MVP


Joe said:
Hi John

The name Code was just an example.

Anything I type, a regular text or even a name - Robert - for example, it
doesn't work.

I'm using a Access 2007 in Brazilian-portuguese version.

This customized version could be the problem? In positive case, is there a
solution?

Thanks in advance for your time and answer.

Joe






John W. Vinson said:
Hi

Using an expression as follows...

SELECT IDCustomer AS Code, Name, Address FROM Customers

...the AS clause doesn't work in Access 2007.

Running the query, the column caption remains IDCustomer.

What is the problem? Why this happens?

Is there any solution (except back to 2003)?

Thanks in advance for your help.

Joe
This is probably another reserved name. 2007 is much pickier about using
reserved words (Code, Date, Order, etc.) as fieldnames.

Does it work if you use AS CustomerCode? Or you might try

AS
Code:
[/QUOTE]


.
[/QUOTE]
 
J

John Spencer

I can't say this is happening and can't test to see if this behavior is
different in 2007 versus 2003.

I would check that there is no Caption property set for the fields. Access
tends to display that as a column header (name) when you are displaying the
results of a query in datasheet view. Besides checking the fields in the
tables, check the caption property of the fields in the query if you are using
query design view.

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
Hi John

The name Code was just an example.

Anything I type, a regular text or even a name - Robert - for example, it
doesn't work.

I'm using a Access 2007 in Brazilian-portuguese version.

This customized version could be the problem? In positive case, is there a
solution?

Thanks in advance for your time and answer.

Joe






John W. Vinson said:
Hi

Using an expression as follows...

SELECT IDCustomer AS Code, Name, Address FROM Customers

...the AS clause doesn't work in Access 2007.

Running the query, the column caption remains IDCustomer.

What is the problem? Why this happens?

Is there any solution (except back to 2003)?

Thanks in advance for your help.

Joe
This is probably another reserved name. 2007 is much pickier about using
reserved words (Code, Date, Order, etc.) as fieldnames.

Does it work if you use AS CustomerCode? Or you might try

AS
Code:
[/QUOTE]
 

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