Using Like In An Update Query

A

Arturo

I have a table with Locations listed. When an order comes into the database
it is qualified by the Location table. The location, along with corresponding
fields, is then appended to an Orders table.

However, there are some orders that do not match up with the Location table
and I have no way of getting them to fit into that table because of factors
that constantly change. Once in the Orders table, I need to identify them.
All of these will start with the letter A or B and will be followed by the
number 1 thru 8. Examples are: A1, A2, B1, B2, etc. If it starts with the
letter A or B and is followed by the number 1 thru 8, I need to identify it.

How do I do that using Like in the criteria field of a query?

Thank you.
 
K

KARL DEWEY

WHERE ([Location] Like "A*" Or [Location] Like "B*" ) AND
(Right(Left([Location], 2),1) Between 1 AND 8)
 
M

Marshall Barton

Arturo said:
I have a table with Locations listed. When an order comes into the database
it is qualified by the Location table. The location, along with corresponding
fields, is then appended to an Orders table.

However, there are some orders that do not match up with the Location table
and I have no way of getting them to fit into that table because of factors
that constantly change. Once in the Orders table, I need to identify them.
All of these will start with the letter A or B and will be followed by the
number 1 thru 8. Examples are: A1, A2, B1, B2, etc. If it starts with the
letter A or B and is followed by the number 1 thru 8, I need to identify it.

How do I do that using Like in the criteria field of a query?


Try using:

Like "[AB][1-8]"
 
A

Arturo

This looks like a SQL statement. I need something to put in the criteria
field of a query. Also Like "[AB][1-8]" did not work. I have to isolate the
first two characters only.

Thanks.

KARL DEWEY said:
WHERE ([Location] Like "A*" Or [Location] Like "B*" ) AND
(Right(Left([Location], 2),1) Between 1 AND 8)

Arturo said:
I have a table with Locations listed. When an order comes into the database
it is qualified by the Location table. The location, along with corresponding
fields, is then appended to an Orders table.

However, there are some orders that do not match up with the Location table
and I have no way of getting them to fit into that table because of factors
that constantly change. Once in the Orders table, I need to identify them.
All of these will start with the letter A or B and will be followed by the
number 1 thru 8. Examples are: A1, A2, B1, B2, etc. If it starts with the
letter A or B and is followed by the number 1 thru 8, I need to identify it.

How do I do that using Like in the criteria field of a query?

Thank you.
 
D

Douglas J. Steele

Marshall Barton said:
Arturo said:
I have a table with Locations listed. When an order comes into the
database
it is qualified by the Location table. The location, along with
corresponding
fields, is then appended to an Orders table.

However, there are some orders that do not match up with the Location
table
and I have no way of getting them to fit into that table because of
factors
that constantly change. Once in the Orders table, I need to identify them.
All of these will start with the letter A or B and will be followed by the
number 1 thru 8. Examples are: A1, A2, B1, B2, etc. If it starts with the
letter A or B and is followed by the number 1 thru 8, I need to identify
it.

How do I do that using Like in the criteria field of a query?


Try using:

Like "[AB][1-8]"

Shouldn't that be

Like "[AB][1-8]*"
 
A

Arturo

That worked. Thanks.

Douglas J. Steele said:
Marshall Barton said:
Arturo said:
I have a table with Locations listed. When an order comes into the
database
it is qualified by the Location table. The location, along with
corresponding
fields, is then appended to an Orders table.

However, there are some orders that do not match up with the Location
table
and I have no way of getting them to fit into that table because of
factors
that constantly change. Once in the Orders table, I need to identify them.
All of these will start with the letter A or B and will be followed by the
number 1 thru 8. Examples are: A1, A2, B1, B2, etc. If it starts with the
letter A or B and is followed by the number 1 thru 8, I need to identify
it.

How do I do that using Like in the criteria field of a query?


Try using:

Like "[AB][1-8]"

Shouldn't that be

Like "[AB][1-8]*"
 
K

KARL DEWEY

I see you got your answer but here is the criteria Location --
Like "A*" Or [Location] Like "B*"

AND you would also need a calculated field --
MyLocation: Right(Left([Location], 2),1)
with criteria --
Between 1 AND 8

Both criteria on the same criteria row in design view.

Arturo said:
This looks like a SQL statement. I need something to put in the criteria
field of a query. Also Like "[AB][1-8]" did not work. I have to isolate the
first two characters only.

Thanks.

KARL DEWEY said:
WHERE ([Location] Like "A*" Or [Location] Like "B*" ) AND
(Right(Left([Location], 2),1) Between 1 AND 8)

Arturo said:
I have a table with Locations listed. When an order comes into the database
it is qualified by the Location table. The location, along with corresponding
fields, is then appended to an Orders table.

However, there are some orders that do not match up with the Location table
and I have no way of getting them to fit into that table because of factors
that constantly change. Once in the Orders table, I need to identify them.
All of these will start with the letter A or B and will be followed by the
number 1 thru 8. Examples are: A1, A2, B1, B2, etc. If it starts with the
letter A or B and is followed by the number 1 thru 8, I need to identify it.

How do I do that using Like in the criteria field of a query?

Thank you.
 
J

John W. Vinson

All of these will start with the letter A or B and will be followed by the
number 1 thru 8. Examples are: A1, A2, B1, B2, etc. If it starts with the
letter A or B and is followed by the number 1 thru 8, I need to identify it.

LIKE "[AB][1-8]*"
 
M

Marshall Barton

Douglas said:
Arturo wrote: []
All of these will start with the letter A or B and will be followed by the
number 1 thru 8. Examples are: A1, A2, B1, B2, etc.


Try using:

Like "[AB][1-8]"

Shouldn't that be

Like "[AB][1-8]*"


That's what I was going to post, but I didn't see anything
that said there could be more than two characters so I
removed the *

Bad guess
 

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