Solved

Access Update Query Wizard:  Multiple Criteria for same field

Posted on 2013-11-20
6
4,727 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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 

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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

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.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

622 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