473,231 Members | 2,035 Online

# Calculate on true - false values

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?

Sep 3 '18 #1

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)

3 4331
NeoPa
32,554 Expert Mod 16PB
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
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
32,554 Expert Mod 16PB
A pleasure Geoff.

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