473,231 Members | 2,035 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,231 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 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

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: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

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.