469,071 Members | 1,988 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,071 developers. It's quick & easy.

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?

Thanks in advance
Sep 3 '18 #1

✓ answered by NeoPa

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 3888
NeoPa
32,154 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,154 Expert Mod 16PB
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.

Similar topics

35 posts views Thread by Steven Bethard | last post: by
14 posts views Thread by Walter Dnes (delete the 'z' to get my real address | last post: by
59 posts views Thread by Pierre Quentel | last post: by
6 posts views Thread by DotNetNewbie | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.