SQL Update Statement

B

Bonnie

Can anyone tell my why my following “Run SQL†update statement is not
working, please?

I want Access to look in my “UPC DESC†column for any product with
“strawberry†in the name.

It could be:
8†Strawberry Shortcake
Strawberry Cream Pie
4†Strawberry tort
Etc.


Then, when it finds these products I want it to enter “Strawberry†in the
“FLAVOR†column.


The table is titled: “FYCâ€


This is how I have written it:
UPDATE FYC SET Berry = 'Strawberry' WHERE [UPC Desc] = '*strawberry*' and
Division = 'ACME'


What am I doing wrong?
 
K

KARL DEWEY

Try this --
UPDATE FYC SET Berry = "Strawberry" WHERE [UPC Desc] Like "*strawberry*" and
Division = "ACME"
 
L

Larry Linson

I agree with Karl... your original query is looking for UPC Desc that is the
text '*strawberry*', nothing more and nothing less -- that is what the =
operator does. "Like" allows the use of the wildcard '*', so will find any
that contain 'strawberry' with any number of preceding or following
characters.

Larry Linson
Microsoft Office Access MVP

KARL DEWEY said:
Try this --
UPDATE FYC SET Berry = "Strawberry" WHERE [UPC Desc] Like "*strawberry*"
and
Division = "ACME"

--
KARL DEWEY
Build a little - Test a little


Bonnie said:
Can anyone tell my why my following "Run SQL" update statement is not
working, please?

I want Access to look in my "UPC DESC" column for any product with
"strawberry" in the name.

It could be:
8" Strawberry Shortcake
Strawberry Cream Pie
4" Strawberry tort
Etc.


Then, when it finds these products I want it to enter "Strawberry" in the
"FLAVOR" column.


The table is titled: "FYC"


This is how I have written it:
UPDATE FYC SET Berry = 'Strawberry' WHERE [UPC Desc] = '*strawberry*' and
Division = 'ACME'


What am I doing wrong?
 

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