Update Query Help

S

Studebaker

Hello,

I have a small test table called 'Flavors'. It has 2 fields:
Field 1: 'FlavorID' and
Field 2: 'Flavor'.
In the 'Flavor' field I have different flavors of ice cream like vanilla,
chocolate, etc.

I tried to create an Update Query that would change 'chocolate' in the
'Flavor' field to 'peppermint'--it didn't work.

In the "UpdateTo" row of the Update Query I put [Flavor]="Peppermint" and
in the "Criteria" row of the query I put "Chocolate".

When I run the query the 'chocolate' in the Flavor field has a 0 in it.

How do I make this run properly?

Thanks
 
F

fredg

Hello,

I have a small test table called 'Flavors'. It has 2 fields:
Field 1: 'FlavorID' and
Field 2: 'Flavor'.
In the 'Flavor' field I have different flavors of ice cream like vanilla,
chocolate, etc.

I tried to create an Update Query that would change 'chocolate' in the
'Flavor' field to 'peppermint'--it didn't work.

In the "UpdateTo" row of the Update Query I put [Flavor]="Peppermint" and
in the "Criteria" row of the query I put "Chocolate".

When I run the query the 'chocolate' in the Flavor field has a 0 in it.

How do I make this run properly?

Thanks

Your query is working correctly.
You're updating the field to the value of the expression
[Flavor] = "Pepperment", which is 0 (False).

You don't need the "[Flavor] =" part.

In the "UpdateTo" row of the Update Query put "Peppermint" and
in the "Criteria" row of the query put "Chocolate".

If you then switch to Query SQL view, the query will read:

Update YourTable Set YourTable.[Flavor] = "Pepperment"
Where YourTable.[Flavor] = "Chocolate";
 
S

Studebaker

Thank you, Fredg. You helped alot!

fredg said:
Hello,

I have a small test table called 'Flavors'. It has 2 fields:
Field 1: 'FlavorID' and
Field 2: 'Flavor'.
In the 'Flavor' field I have different flavors of ice cream like vanilla,
chocolate, etc.

I tried to create an Update Query that would change 'chocolate' in the
'Flavor' field to 'peppermint'--it didn't work.

In the "UpdateTo" row of the Update Query I put [Flavor]="Peppermint" and
in the "Criteria" row of the query I put "Chocolate".

When I run the query the 'chocolate' in the Flavor field has a 0 in it.

How do I make this run properly?

Thanks

Your query is working correctly.
You're updating the field to the value of the expression
[Flavor] = "Pepperment", which is 0 (False).

You don't need the "[Flavor] =" part.

In the "UpdateTo" row of the Update Query put "Peppermint" and
in the "Criteria" row of the query put "Chocolate".

If you then switch to Query SQL view, the query will read:

Update YourTable Set YourTable.[Flavor] = "Pepperment"
Where YourTable.[Flavor] = "Chocolate";
 

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