Solved

Access Update Query Wizard:  Multiple Criteria for same field

Posted on 2013-11-20
6
4,322 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 

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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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.

808 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