Solved

Access Update Query Wizard:  Multiple Criteria for same field

Posted on 2013-11-20
6
4,230 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
  • 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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 

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 500 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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Suggested Solutions

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

803 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