A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

MS Access 2003 SQL Statement



 
 
Thread Tools Display Modes
  #1  
Old October 2nd, 2005, 02:56 AM
royeil
external usenet poster
 
Posts: n/a
Default MS Access 2003 SQL Statement

I am new to SOL and am trying to get the following statement to execute in
Access 2003. I am using the RTRIM to remove trailing spaces from the
Customers FirstName and combine it with the last name in a new field called
Name.

SELECT RTRIM (FirstName) & ' ' & LastName AS Name
FROM Customer;

When executing this query I always get a Compile error. Can anyone help?




  #2  
Old October 2nd, 2005, 03:14 AM
Tom Ellison
external usenet poster
 
Posts: n/a
Default

Dear Roy:

Use double quotes in a Jet query for a literal string. Does that fix it?
--
Tom Ellison


"royeil" wrote in message
...
I am new to SOL and am trying to get the following statement to execute in
Access 2003. I am using the RTRIM to remove trailing spaces from the
Customers FirstName and combine it with the last name in a new field

called
Name.

SELECT RTRIM (FirstName) & ' ' & LastName AS Name
FROM Customer;

When executing this query I always get a Compile error. Can anyone help?






  #3  
Old October 2nd, 2005, 03:17 AM
Rick Brandt
external usenet poster
 
Posts: n/a
Default

royeil wrote:
I am new to SOL and am trying to get the following statement to
execute in Access 2003. I am using the RTRIM to remove trailing
spaces from the Customers FirstName and combine it with the last name
in a new field called Name.

SELECT RTRIM (FirstName) & ' ' & LastName AS Name
FROM Customer;

When executing this query I always get a Compile error. Can anyone
help?


Where exactly are you trying to "execute" this? A compile error suggests that
you are typing this in a code window. SQL statements don't run from a code
module on their own.

Or are you typing this into the SQL view of the query designer (which would
work)?

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com



  #4  
Old October 2nd, 2005, 04:51 AM
royeil
external usenet poster
 
Posts: n/a
Default

Tom

I have tried various methods. Enclosing the field name in " " as follows
is one. Did not work however.
SELECT RTRIM ("FirstName") & ' ' & LastName AS Name
FROM Customer;


Is this what you are suggesting?




"Tom Ellison" wrote:

Dear Roy:

Use double quotes in a Jet query for a literal string. Does that fix it?
--
Tom Ellison


"royeil" wrote in message
...
I am new to SOL and am trying to get the following statement to execute in
Access 2003. I am using the RTRIM to remove trailing spaces from the
Customers FirstName and combine it with the last name in a new field

called
Name.

SELECT RTRIM (FirstName) & ' ' & LastName AS Name
FROM Customer;

When executing this query I always get a Compile error. Can anyone help?







  #5  
Old October 2nd, 2005, 05:00 AM
royeil
external usenet poster
 
Posts: n/a
Default

Rick

I am typing this in the Query SQL view. I have tried using all the TRIM
keywords and always get a compile error. Nothing seems to work. I am taking
an online Introduction to SQL Course at a local community college and this is
one of the practice exercises. The instructor has been unable to solve the
issue. The statement is suppose to work in Access version 2000 but I am using
2003.

I have tried to build the query using the expression wizzard and get the
same compile error as well.

Not sure where to go from here!

Thanks for the help!
Roy


"Rick Brandt" wrote:

royeil wrote:
I am new to SOL and am trying to get the following statement to
execute in Access 2003. I am using the RTRIM to remove trailing
spaces from the Customers FirstName and combine it with the last name
in a new field called Name.

SELECT RTRIM (FirstName) & ' ' & LastName AS Name
FROM Customer;

When executing this query I always get a Compile error. Can anyone
help?


Where exactly are you trying to "execute" this? A compile error suggests that
you are typing this in a code window. SQL statements don't run from a code
module on their own.

Or are you typing this into the SQL view of the query designer (which would
work)?

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com




  #6  
Old October 2nd, 2005, 06:10 AM
Amy Blankenship
external usenet poster
 
Posts: n/a
Default

Try

SELECT RTrim(FirstName) & " " & LastName AS FullName
FROM Customer.

Also, try this in the regular view of the query builder

FullName: RTrim(FirstName) & " " & LastName

with customer shown in the pane above the grid.

HTH;

Amy

"royeil" wrote in message
...
Tom

I have tried various methods. Enclosing the field name in " " as follows
is one. Did not work however.
SELECT RTRIM ("FirstName") & ' ' & LastName AS Name
FROM Customer;


Is this what you are suggesting?




"Tom Ellison" wrote:

Dear Roy:

Use double quotes in a Jet query for a literal string. Does that fix it?
--
Tom Ellison


"royeil" wrote in message
...
I am new to SOL and am trying to get the following statement to execute
in
Access 2003. I am using the RTRIM to remove trailing spaces from the
Customers FirstName and combine it with the last name in a new field

called
Name.

SELECT RTRIM (FirstName) & ' ' & LastName AS Name
FROM Customer;

When executing this query I always get a Compile error. Can anyone
help?









  #7  
Old October 2nd, 2005, 01:20 PM
Rick Brandt
external usenet poster
 
Posts: n/a
Default

royeil wrote:
Rick

I am typing this in the Query SQL view. I have tried using all the
TRIM keywords and always get a compile error. Nothing seems to work.
I am taking an online Introduction to SQL Course at a local community
college and this is one of the practice exercises. The instructor has
been unable to solve the issue. The statement is suppose to work in
Access version 2000 but I am using 2003.

I have tried to build the query using the expression wizzard and get
the same compile error as well.

Not sure where to go from here!


If an Access file has any missing or broken references it causes many if the
built in functions to not work. I don't specifically recall Trim being one of
these but it's certainly possible.

In a code window look at Tools - References and see if any are marked "MISSING".

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com


  #8  
Old October 2nd, 2005, 07:09 PM
Tom Ellison
external usenet poster
 
Posts: n/a
Default

Dear Roy:

No, I was suggesting replacing the single quotes you already had with double
quotes:

SELECT RTRIM(FirstName) & " " & LastName AS Name
FROM Customer;

If you have a references problem with RTRIM then try it without that:

SELECT FirstName & " " & LastName AS Name
FROM Customer;

If that fixes it, you need to add references.
--
Tom Ellison


"royeil" wrote in message
...
Tom

I have tried various methods. Enclosing the field name in " " as follows
is one. Did not work however.
SELECT RTRIM ("FirstName") & ' ' & LastName AS Name
FROM Customer;


Is this what you are suggesting?




"Tom Ellison" wrote:

Dear Roy:

Use double quotes in a Jet query for a literal string. Does that fix

it?
--
Tom Ellison


"royeil" wrote in message
...
I am new to SOL and am trying to get the following statement to

execute in
Access 2003. I am using the RTRIM to remove trailing spaces from the
Customers FirstName and combine it with the last name in a new field

called
Name.

SELECT RTRIM (FirstName) & ' ' & LastName AS Name
FROM Customer;

When executing this query I always get a Compile error. Can anyone

help?









  #9  
Old October 2nd, 2005, 09:14 PM
royeil
external usenet poster
 
Posts: n/a
Default

Amy

I tried what you suggested and still get a complie error.

Thanks

"Amy Blankenship" wrote:

Try

SELECT RTrim(FirstName) & " " & LastName AS FullName
FROM Customer.

Also, try this in the regular view of the query builder

FullName: RTrim(FirstName) & " " & LastName

with customer shown in the pane above the grid.

HTH;

Amy

"royeil" wrote in message
...
Tom

I have tried various methods. Enclosing the field name in " " as follows
is one. Did not work however.
SELECT RTRIM ("FirstName") & ' ' & LastName AS Name
FROM Customer;


Is this what you are suggesting?




"Tom Ellison" wrote:

Dear Roy:

Use double quotes in a Jet query for a literal string. Does that fix it?
--
Tom Ellison


"royeil" wrote in message
...
I am new to SOL and am trying to get the following statement to execute
in
Access 2003. I am using the RTRIM to remove trailing spaces from the
Customers FirstName and combine it with the last name in a new field
called
Name.

SELECT RTRIM (FirstName) & ' ' & LastName AS Name
FROM Customer;

When executing this query I always get a Compile error. Can anyone
help?










  #10  
Old October 2nd, 2005, 09:18 PM
royeil
external usenet poster
 
Posts: n/a
Default

Tom

The statement works fine with out the Rtrim Keyword by leaves unwanted
spaces between the FirstName and LastName in its results. I am not sure what
you mean by references!

Thanks

"Tom Ellison" wrote:

Dear Roy:

No, I was suggesting replacing the single quotes you already had with double
quotes:

SELECT RTRIM(FirstName) & " " & LastName AS Name
FROM Customer;

If you have a references problem with RTRIM then try it without that:

SELECT FirstName & " " & LastName AS Name
FROM Customer;

If that fixes it, you need to add references.
--
Tom Ellison


"royeil" wrote in message
...
Tom

I have tried various methods. Enclosing the field name in " " as follows
is one. Did not work however.
SELECT RTRIM ("FirstName") & ' ' & LastName AS Name
FROM Customer;


Is this what you are suggesting?




"Tom Ellison" wrote:

Dear Roy:

Use double quotes in a Jet query for a literal string. Does that fix

it?
--
Tom Ellison


"royeil" wrote in message
...
I am new to SOL and am trying to get the following statement to

execute in
Access 2003. I am using the RTRIM to remove trailing spaces from the
Customers FirstName and combine it with the last name in a new field
called
Name.

SELECT RTRIM (FirstName) & ' ' & LastName AS Name
FROM Customer;

When executing this query I always get a Compile error. Can anyone

help?










 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
2002 vs 2003 Patrick Stubbin General Discussion 2 May 17th, 2005 07:27 AM
Access 2003 Developer Extension JIM.H. General Discussion 10 May 1st, 2005 05:13 PM
Can One Use Access 2003 on Access 2000 Databases? lbrinkman New Users 2 January 14th, 2005 11:13 PM
EXCELL SQL statement that won't work for ACCESS jackle General Discussion 0 January 8th, 2005 07:13 PM
Access 2000 query SQL statement into VBA code Clint Running & Setting Up Queries 1 June 10th, 2004 01:33 PM


All times are GMT +1. The time now is 08:07 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.