473,403 Members | 2,338 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 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 4347
NeoPa
32,556 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,556 Expert Mod 16PB
A pleasure Geoff.

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

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

Similar topics

35
by: Steven Bethard | last post by:
I have lists containing values that are all either True, False or None, e.g.: etc. For a given list: * If all values are None, the function should return None.
14
by: Walter Dnes (delete the 'z' to get my real address | last post by:
I took a C course some time ago, but I'm only now beginning to use it, for a personal pet project. My current stumbling-block is finding an efficient way to find a match between the beginning of a...
59
by: Pierre Quentel | last post by:
Hi all, In some program I was testing if a variable was a boolean, with this test : if v in My script didn't work in some cases and I eventually found that for v = 0 the test returned True ...
4
by: Steve | last post by:
As you know there is a databindings property 'Enabled' for fields in the gridview. In the custom binding section I have used the expression: Eval("myfield"). 'myfield' is a boolean field I have...
11
by: klove1209 | last post by:
Good afternoon, Can someone please guide me towards how to return records from a table. I currently have a table with about 21 fields, and 21 records. I have one field that is just text and the...
6
by: DotNetNewbie | last post by:
Hi, I need a datatype (or enum?) that can hold the possible values: true/ false/null I will use it in ADO.NET code like: sqlCmd.Parameters.Add("@isApproved", SqlDbType.Bit, 1).Value =...
14
by: donbock | last post by:
A side-discussion developed in the Wierd Visual Studio Problem thread. Rather than continue to hijack that topic, I've created a new thread and copied over the relevant postings.
8
NeoPa
by: NeoPa | last post by:
I am trying, with a spectacular lack of success, to return TRUE and FALSE values in my SELECT statement. This SQL (below) is simply illustrative. It doesn't reflect my real world query. I would...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.