471,874 Members | 1,641 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

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 4223
NeoPa
32,468 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,468 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
reply views Thread by YellowAndGreen | last post: by

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.