Update query using Left function

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to update some area codes and want to use the Left function.
What I want is simply to be able to identify the area code so that it may be
deleted, used in a make table query, etc. According to Special Edition Using
Access 2000, by Roger Jennings, page 335, the following should work:

Left ("phone",3)=999

However, when I try to use this in an Update query in the criteria row, the
following message is returned to me. The Expression you entered has a
function containing the wrong number of arguments.

Also, I have found that when I actually update a phone number with an area
code change and I use the following, I don't have any problems.

In the Update row: 777&right([phone],8)

the area code is updated to 777 just fine. 8 has to be used because most of
the phone numbers are formated with a dash between the exchange and last four
digits. Notice the ampersand after 777.

What I am also trying to do is isolate area codes in this way:

Left ("phone",3)=999,222,555. These are several area codes in one
metropolitan area.

What is the correct code to use so that I won't receive these syntax errors?

Then I can do a make table query of the isolated area codes or a delete
query or if necessary, an update query.
 
Yours
Left ("phone",3)=999

Try
Left ([phone],3) = "999"
=========================
Yours
Left ("phone",3)=999,222,555

Try
Left ([phone],3) In ("999","222","555")
=========================
The field name need to be with square brackets, instead of duble quote.
 
Thank you kindly. But why does Roger Jennings book, "Special Edition Using
Access 2000," have them in quotes?

However, your answer is a big help.

Ofer Cohen said:
Yours
Left ("phone",3)=999

Try
Left ([phone],3) = "999"
=========================
Yours
Left ("phone",3)=999,222,555

Try
Left ([phone],3) In ("999","222","555")
=========================
The field name need to be with square brackets, instead of duble quote.

--
Good Luck
BS"D


faxylady said:
I am trying to update some area codes and want to use the Left function.
What I want is simply to be able to identify the area code so that it may be
deleted, used in a make table query, etc. According to Special Edition Using
Access 2000, by Roger Jennings, page 335, the following should work:

Left ("phone",3)=999

However, when I try to use this in an Update query in the criteria row, the
following message is returned to me. The Expression you entered has a
function containing the wrong number of arguments.

Also, I have found that when I actually update a phone number with an area
code change and I use the following, I don't have any problems.

In the Update row: 777&right([phone],8)

the area code is updated to 777 just fine. 8 has to be used because most of
the phone numbers are formated with a dash between the exchange and last four
digits. Notice the ampersand after 777.

What I am also trying to do is isolate area codes in this way:

Left ("phone",3)=999,222,555. These are several area codes in one
metropolitan area.

What is the correct code to use so that I won't receive these syntax errors?

Then I can do a make table query of the isolated area codes or a delete
query or if necessary, an update query.
 
I didn't read Roger Jennings book, but it could be that in the example they
wanted to show how to retrieve the three left chr of a string

Left("ABCDE",3)
will return "ABC"

but to refer to another field you need to put the name of the field in
square brackets

--
Good Luck
BS"D


faxylady said:
Thank you kindly. But why does Roger Jennings book, "Special Edition Using
Access 2000," have them in quotes?

However, your answer is a big help.

Ofer Cohen said:
Yours
Left ("phone",3)=999

Try
Left ([phone],3) = "999"
=========================
Yours
Left ("phone",3)=999,222,555

Try
Left ([phone],3) In ("999","222","555")
=========================
The field name need to be with square brackets, instead of duble quote.

--
Good Luck
BS"D


faxylady said:
I am trying to update some area codes and want to use the Left function.
What I want is simply to be able to identify the area code so that it may be
deleted, used in a make table query, etc. According to Special Edition Using
Access 2000, by Roger Jennings, page 335, the following should work:

Left ("phone",3)=999

However, when I try to use this in an Update query in the criteria row, the
following message is returned to me. The Expression you entered has a
function containing the wrong number of arguments.

Also, I have found that when I actually update a phone number with an area
code change and I use the following, I don't have any problems.

In the Update row: 777&right([phone],8)

the area code is updated to 777 just fine. 8 has to be used because most of
the phone numbers are formated with a dash between the exchange and last four
digits. Notice the ampersand after 777.

What I am also trying to do is isolate area codes in this way:

Left ("phone",3)=999,222,555. These are several area codes in one
metropolitan area.

What is the correct code to use so that I won't receive these syntax errors?

Then I can do a make table query of the isolated area codes or a delete
query or if necessary, an update query.
 

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

Back
Top