473,472 Members | 2,145 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Returnt he results of 2 boolean variables as one result

Hi All,

I did search for this before posting but I didn't find what I was looking for.
..

I have a function (returning boolean) that in turn calls 2 more functions
(also returning boolean). I know I could do an if statement to see if both
are true and return true, otherwise false, but I got to thinking and I
figured there must be a shorter way to do this.

I had thought maybe math:
result = result1 + result2
but this wouldn't work the way I had thought (True + True = True) - rather -
1 + -1 = -2

Then I thought about the DMAX function (return the largest of the data set):
DMAX (True, False) = false (0)
DMAX (True, True) = True (-1)

but I read all over the these function s aren't a good idea to use over
otheres, so I thought I'd post the question...

Thanks in advance,

Corey

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200610/1

Oct 16 '06 #1
3 1193

Corey-g via AccessMonster.com wrote:
Hi All,

I did search for this before posting but I didn't find what I was looking for.
.

I have a function (returning boolean) that in turn calls 2 more functions
(also returning boolean). I know I could do an if statement to see if both
are true and return true, otherwise false, but I got to thinking and I
figured there must be a shorter way to do this.
Function BothTrue(blnArg1 as boolean, blnArg2 as boolean) as boolean
BothTrue = blnArg1 And blnArg2
End Function

Oct 16 '06 #2
I knew that there awas a shorter way than an if statement.

Thanks so much!!!

Corey

--
Message posted via http://www.accessmonster.com

Oct 16 '06 #3
Corey,
if your function is simple, you would be better off doing the
calculation in a query. Only use functions if you have to. For
example, if your function can take varied parameters and has complex
business logic.

You could easily do something like this in a query:

SELECT Field1, Field2, (booleanField1 AND booleanField2) AS
ReturnBoolean
FROM SomeTable...

won't really matter that much when you have a small DB, but the bigger
you get, the more important it is to use the best/most efficient tool
available.

HTH,
Pieter

Oct 17 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: AbeR | last post by:
I have written a fairly simple reporting app that has been working for a few years without any issues until this past week. The application has a login page with a DSN lookup for login/password...
3
by: Gargamil | last post by:
I've written a function to calculate a seriies of parameters based upon some variables. I'd like to be able to return all the parameters to a query. Now all the parameters are interrelated and...
8
by: FrancisC | last post by:
how to define Boolean in C ? boolean abc; ??? is it default as True or False??
2
by: Rosanne Rohana | last post by:
I'm trying for return user info (first name, last name, etc.) from a Netscape 4.16 LDAP server using the System.DirectoryServices. I'm able to get authenticated successfully, but when I attempt to...
14
by: Mr Newbie | last post by:
I am often in the situation where I want to act on the result of a function, but a simple boolean is not enough. For example, I may have a function called isAuthorised ( User, Action ) as ?????...
10
by: Lloyd Harold | last post by:
I'm very new to PHP and attempting to put together a simple script for retrieving MySQL data of personal records. The MySQL table I'm using consists of: 0: id 1: name 2: location (an integer...
1
by: russot00 | last post by:
I have 3 drop down menus that are used in a search to locate restaurants in a db. All of the drop down menus function, a search can be submitted with any combination of drop downs and the results are...
6
by: Avi | last post by:
I need to implement the following calculation: f = (a*b) + (c*d) where a,b,c,d are given double values and f is a double variable for the result I found out that using two different...
2
by: JamesDelaney | last post by:
Hi all, I'm creating a number of fragments to calculate various presence numbers. I'm creating variables from the results of these fragments then doing simple math to give the results. I'm...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...
1
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...
1
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.