?
Solved

Access Update Query Wizard:  Multiple Criteria for same field

Posted on 2013-11-20
6
Medium Priority
?
4,960 Views
Last Modified: 2013-11-20
In my update query, I have 3 requirements:
If the Country field in the Trans table is:
USA, then Base Rate field = 11%
UK, then the Base Rate field = 12%
Canada, then the Base Rate field = 13%.

Using the query builder, I listed the the Base Rate field three times (see below).  Will this work?  If not, how do I do this?  Thank you.

Tom

Field:               Base Rate    Base Rate     Base Rate
Table:              Trans            Trans            Trans
Update to:       .11               .12                .13
Criteria:           "USA"           "UK"             "Canada"
0
Comment
Question by:ThomasJue
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 39664714
Field:               Base Rate  
Table:              Trans    
Update to:      IIf([Country]="USA",.11, IIf([Country]="UK",.12, IIf([Country]="Canada",.13,Null)))

in SQL view

Update Trans Set [Base Rate]= IIf([Country]="USA",.11, IIf([Country]="UK",.12, IIf([Country]="Canada",.13,Null)))
0
 

Author Comment

by:ThomasJue
ID: 39664721
I can't do this using the Query Wizard such as below?
I realized I goofed my example in the Criteria above.  Hopefully this example is better.

Field:               Base Rate                Base Rate             Base Rate
Table:              Trans                       Trans                     Trans
Update to:       .11                          .12                         .13
Criteria:           [Trn]![Cty]="USA"     [Trn]![Cty]="UK"     [Trn]![Cty]="Canada"
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 39664732
what exactly are the names of the fields of table Trans?
0
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 

Author Comment

by:ThomasJue
ID: 39664742
I goofed it again.  The table is Trans so the criteria should read:
[Trans]![Cty]='USA', etc.

So I am only comparing the Cty field name to see if it is USA, UK or Canada.

Thank you.
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 total points
ID: 39664752
did you try the set up i posted above?

Field:               Base Rate  
Table:              Trans    
Update to:      IIf([Cty]="USA",.11, IIf([Cty]="UK",.12, IIf([Cty]="Canada",.13,Null)))
0
 

Author Comment

by:ThomasJue
ID: 39664761
Not yet.  I am waiting for the answer to the question I just posted on how to change after the Criteria line from "or" to "and".  Then I can try it.  Thanks.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question