423,680 Members | 2,394 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 423,680 IT Pros & Developers. It's quick & easy.

Calculate on true - false values

P: 2
Gday.
I have a databse Im trying to work on. It has a series of boxes that depending on various inputs provides a overall total.

I want to add a tick box named [DDT] and a field for its calculation [CalcDDT], on "true" I want the [CalcDDT] to display a number (say 20.. but any number really). Which I can accomplish using " iif" but because of the other fields it will not allow the total calculation when it is "false".

Ive had a crack at and/ or, but obviously missing something.

So what I am trying to do is have [CalcDDT] = 20 on [DDT] true and =0 on [DDT] false.

Any idea on how I can accomplish this please?

Thanks in advance
Sep 3 '18 #1
Share this Question
Share on Google+
3 Replies


NeoPa
Expert Mod 15k+
P: 31,084
Is this in a query or on a form?

If [DDT] is a boolean field in the query then another field, of the query, could be :
Expand|Select|Wrap|Line Numbers
  1. CalcDDT: IIf([DDT],20,0)
Forms have Controls. Controls can be either :
  1. Bound to a Field from the RecordSource.
  2. Bound to an expression.
  3. Unbound.
An expression in a #2 Control could be (Assuming you have a CheckBox Control called [chkDDT]) :
Expand|Select|Wrap|Line Numbers
  1. =IIf([chkDDT],20,0)
Sep 3 '18 #2

P: 2
Thanks NeoPA.
Its on a form. Ill give that a go, quite new to Access and what can be done with it so thank you for the response, greatly appreciated.
Sep 6 '18 #3

NeoPa
Expert Mod 15k+
P: 31,084
A pleasure Geoff.

Let us know how it works for you :-)
Sep 6 '18 #4

Post your reply

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