ACCESS Update Query with If Then Else????

G

Guest

Can't find any reference when seacrhing through the Forums on how to do this kind of update... unless there are just so many that I can't see the forest through the tree.

What I want to do is to use Criteria in 2 fields. If both criteria are met, set a field to one value. If the criteria are not correct, set it to another.

I know there's gotta be a way to do this.

THanks
 
F

fredg

Can't find any reference when seacrhing through the Forums on how to do this kind of update... unless there are just so many that I can't see the forest through the tree.

What I want to do is to use Criteria in 2 fields. If both criteria are met, set a field to one value. If the criteria are not correct, set it to another.

I know there's gotta be a way to do this.

THanks

UPDATE YourTable SET YourTable.FieldName = IIf([LastName]="Smith" And
[FirstName]="John",SomeNumberValue,OtherNumberValue);

Text values must be enclosed within quotes, number values do not get
the quotes.
 

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