We help IT Professionals succeed at work.

if...then

jrhinely
jrhinely asked
on
Medium Priority
422 Views
Last Modified: 2008-02-26
ok, I'm totally lost when it comes to programming access. So
   here's what seems so simple but doesn't work for me.  (Access 97): Let's keep it
   simple.  I have 3 fields on a form (from a table). The fields are "subtotal", "tax", and
   "total".  The "tax" field is a check box (yes/no). My expression in the "total" field
   states:  Iff([tax]="yes",[total]=(.07*[subtotal]),
   [total]=[subtotal])
I'm getting to old for this.  Basic was easy for me, this is not.
J. Hinely
Comment
Watch Question

Commented:
I am no expert by any stretch, but I don't think you want to use an immediate If statement in your example, I would think that you would use an If then statement. Instead of using the expression builder, try using the code builder.

If([Tax]="yes", then
   [Total]= 0.07*[Subtotal]

I think this might work for you.

Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Try it like this  IIF([tax],[total]=(1.07*[subtotal]),[total]=[subtotal])
CERTIFIED EXPERT

Commented:
You don't need the [total]= part. Try this:

IIf([tax],(1.07*[subtotal]),[subtotal])
Great peace of code Tuvi and TerryEllis, I forgot all about IIF, thanks for the reminder.
tuvi, your right on about not needing the "[total] = part". Thank you for the correction.

Author

Commented:
Thanks, guys.  I wish I could award all of you some points.  Actually "tuvi" had what I used.

Commented:
Guess tuvi deserves the points uhhh!

Tuvi, I'll post an answer worth 50 points so you can get them!

Later
Jorge
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.