Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Expert 25    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Having trouble with SWITCH
Yonatan Weinberg 
     
2 years ago
I'm trying to make a field in a Query that will calculate SDLT(a property tax in the UK), I'm using the Switch function but it only works if the calculation is a simple one Like this: Switch([PurchasePrice]<=40000,[PurchasePrice]*0).

However when I make it a bit more comlicated like this: Switch([PurchasePrice]<=925000,[PurchasePrice]-250000*0.08+7500) all of a sudden it just skips parts of the calculation.

If anyone can help me understand what I'm doing wrong I would really appreciate it.

Many thanks,
Yonatan
Kevin Robertson  @Reply  
          
2 years ago
Do the calculation first then use the Switch function based on the calculated field.
You will probably need 2 queries for this.
Yonatan Weinberg OP  @Reply  
     
2 years ago
How would I do this?
Kevin Robertson  @Reply  
          
2 years ago
See this post from last week: Switch Function
Yonatan Weinberg OP  @Reply  
     
2 years ago
Hi Kevin,

Thank you for your help, I can't seem to figure it out.
What do I need to concatenate? Also how would another Query help?

What I'm trying to do is to manipulate the data in my field called PurchasePrice which is a currency field.

Hope I'm not being too complicated, Thank you
Richard Rost  @Reply  
          
2 years ago
Are you trying to CHANGE the PurchasePrice or set a value in a new calculated field? Let's see EXACTLY what you're trying to do (screen shots help).
Yonatan Weinberg OP  @Reply  
     
2 years ago
I'm tyring to set a value in a new calculated field
Yonatan Weinberg OP  @Reply  
     
2 years ago

Yonatan Weinberg OP  @Reply  
     
2 years ago

Kevin Robertson  @Reply  
          
2 years ago
Not sure what the problem is. Isn't '237, 500 the correct value?
Yonatan Weinberg OP  @Reply  
     
2 years ago
No the correct answer should be 7,500
Kevin Robertson  @Reply  
          
2 years ago
You will need parentheses. Remember Multiplication comes BEFORE Addition and subtraction.

250,000 - 250,000 * 0.08 + 7,500 = 237,500
250,000 - (250,000 * 0.08) + 7,500 = 237,500

(250,000 - 250,000) * 0.08 + 7500 = 7,500
Yonatan Weinberg OP  @Reply  
     
2 years ago
Wow, Thanks Kevin! It's working now, is there anywhere that Richard covers this?
Kevin Robertson  @Reply  
          
2 years ago
The Order of Operations is mentioned in Access Expert 8

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Expert 25.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/6/2026 11:00:52 PM. PLT: 0s