473,387 Members | 1,619 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Automating Access form to remove tax when tax "yes/no" field is unchecked

I've been using Access for awhile, although not very familiar with VB. I am designing an order form that automatically calculates tax on the products ordered. On the form and in the underlying table, I have a yes/no field to check if the customer is taxable. I would like the expression I built to calculate tax on the form, to =0 if the yes/no field is unchecked, meaning the customer is nontaxable. Any simple way to do this?
Thanks for any help
Feb 20 '13 #1
16 1658
zmbd
5,501 Expert Mod 4TB
Not really sure if all of your control names and field names.
However the basic would be to use an IIF() in an unbound field.
It will also vary a tad base on the structure of your form

So in the unbound control, in the recordsource property, you'd build your formula. Here's a link to the IIF:
IIf Function

Give-it-whirl, see what you come up with... if you get stuck post back and we'll have a go at it from there!
You can also check out the insight articles
Feb 20 '13 #2
I think I understand, except, the control I am trying to make either show the calculated tax or not, is a calculation. =([qryOrderDetailsExtended subform]![Order Subtotal])*0.06 - it's subtotaling the entended prices and multiplying them by our tax rate, and when I put that calculation in as my positive to if my [taxable] field is yes, I just get ######### in my field on my form. But when I put $0.00 in as my negative, it does work - so I'm not sure if it is still doing the calculation or not.
Thanks again
Feb 20 '13 #3
I should have said that I do have $0.00 in as my false part and when I uncheck the customer's tax status, it does say $0.00, it's just when I check the status as taxable, I get the ######
Feb 20 '13 #4
Seth Schrock
2,965 Expert 2GB
If you are just getting ########, then that just means that your control isn't big enough to display your data. You just need to make your control wider.
Feb 20 '13 #5
Thanks Seth, but I had tried adjusting the control size earlier and got the same. The total should be only over $1000.00 and I have the decimal spaces set to 2 - I'm thinking it's got to be in my code.
Feb 21 '13 #6
zmbd
5,501 Expert Mod 4TB
@mulchgirl:
For a temporary check...
Please go back in to the design mode of the form.
Please double the width of the control that has the calculation.
You do not need to save it at this point...
Switch from design to form view.
Hopefully you will see the expected result.


@All:
We've started branching on this thread from the original question; however because we haven't yet verified the calculation's result due to the formatting issue, I think it's allowable.
Once mulchgirl has verified the results, the formatting question should be started in a new thread, with reference to this thread if the information is needed for clarity.
Feb 21 '13 #7
zmbd - sorry if I am causing an issue - I expanded the width and what shows in the control is not an answer to my calculation, but just the calculation...... =([qryOrderDetailsExtended subform]![Order Subtotal])*0.06. Do I need to add something to my IIf statment to have it calculate? Thanks so much.
Feb 21 '13 #8
zmbd
5,501 Expert Mod 4TB
If you are still in design view, that is expected; hoewever, if you are in Form view then we have an issue with how the formula was entered into the control.

Please confirm what you saw in the Form view.
Feb 21 '13 #9
When I am in form view, it shows the calculation: ([qryOrderDetailsExtended subform]!]Order Subtotal])*0.06 in the control - exactly what I typed in the control in the design view, in the truepart of the IIf function. To help explain more, In my Orders table, I have a field named "Taxable", it's data type is yes/no. I added this field to an "Orders" form (this is based on a query that combines the Orders table and Order Details table). On this form I have a a control that calculates the totals of all the products for the one order (which is the above calculation). My goal is to have a control that calculates tax of 6% on the total fo the products if the customer is taxable. I hope my expanation helps, and doesn't just show how little I understand ;)
Feb 21 '13 #10
Seth Schrock
2,965 Expert 2GB
While in design view, you need to enter an equals sign (=) before your calculation.
Feb 21 '13 #11
Seth, I tried adding the = sign before the equation and after the ", in the truepart, and it still shows only the equation itself, not a result of the calculation.
Feb 25 '13 #12
Seth Schrock
2,965 Expert 2GB
I'm not seeing the " in your equation, so I'll how the equation should be put into the textbox in design view:
Expand|Select|Wrap|Line Numbers
  1. =([qryOrderDetailsExtended subform]!]Order Subtotal])*0.06
Feb 25 '13 #13
Yeah, sorry - the " " were for around my equation in the true part of my IIf statement. My Iff statement now looks like this:
Expand|Select|Wrap|Line Numbers
  1. =IIf([Taxable]=Yes, "=[qryOrderDetailsExtended subform]![Order Subtotal]*.06)","$0.00")
. I am getting the result of $0.00 if I uncheck my taxable box (which is what I want), but if my taxable box is checked, all that shows in my control in the form view is =[qryOrderDetailsExtended subform]![Order Subtotal]*.06" - Thanks for all your help!
Feb 25 '13 #14
zmbd
5,501 Expert Mod 4TB
Remove the inner double quotes.
Expand|Select|Wrap|Line Numbers
  1. =IIf([Taxable]=Yes, ([qryOrderDetailsExtended subform]![Order Subtotal]*.06),"$0.00")
Feb 25 '13 #15
Yes, yes, yes!!!! Thank you very much - it worked. Can I ask why the removal of the " "? And sorry about not using the code button - thanks for you patience - you have been a great help.
Feb 25 '13 #16
zmbd
5,501 Expert Mod 4TB
Anything placed between the quotes is taken as a literal string; therefor, treated as a text value to display.

Scroll to the bottom of this page,
Click on the Microsoft Access Insights Site Map Link
Read articles:
174. Literal DateTimes and Their Delimiters (#) and
175. Quotes (') and Double-Quotes (") - Where and When to use them
Feb 25 '13 #17

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Carl | last post by:
This is perhaps a very simple and stupid question! How do you run a specific function (with actual values for the parameters) within a module from the command prompt? That is, with "python ..." ...
4
by: TonyJeffs | last post by:
<SCRIPT language="JavaScript"> function anna18(){ window.open ("Slideshow/anna18.htm","","scrollbars=no,fullscreen=yes") } </SCRIPT> Why does the above still have a scrollbar? The actual web...
2
by: edgarjang | last post by:
In JavaScript, I can hide menu bar ( ex) <html> <SCRIPT LANGUAGE="JavaScript"> function Test() { var win = window.open("test2.html","sale","menubar=no,scrollbars=no,width=780,height=5...
2
by: kj | last post by:
Here's a puzzle I can't figure out. I visited the page http://validator.w3.org, and confirmed that it validates itself. Then I *saved* it to my docroot directory using my browser's save-as...
5
by: Dave | last post by:
Hello all Is there a yes/no boolean datatype with mySQL? I can't seem to find if there is, and I have used an int type set to 1 or 0 but that breaks some of my apps that used to use access which...
1
by: Ronen Yacov | last post by:
Hi There, I've using IE 7.0.5730.11 on Windows XP. I want to open a pop up using javascript without showing the status bar, and to do so I use the function: function openwindow() {...
1
by: robtyketto | last post by:
Greetings, For my DESKTOP application I have more than one exit button where I would like the user to be prompted to confirm they really wish to exit. Much like in VBA with msgbox VbYesNo...
7
by: EManning | last post by:
I'm using A2003 connected to a SQL 2000 backend. This is not an adp. I have a table which I store 0 and -1 for 2 bit fields. I have a listbox on a form based on a query of this table. The...
1
by: =?Utf-8?B?U3RldmUgQmVobWFu?= | last post by:
I am using Visual C++ 8.0 Express Edition. On certain events I would like to pop up the standard "Yes/No" dialog -- is this possible and, if so, how is this done?
0
by: Sandra Osorio | last post by:
Am Using MS Access and got a field which uses a drop list (yes/no field). When I select the “No” option, I’d like to jump into a different field (The name of this field is “fumaba”). How can I jump...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.