473,695 Members | 2,402 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Returning True, False, and True Or False records

I have a field called "Wiring" in a query which is boolean. If I place "True
Or False" in the criteria for the field, I get all records (there are no
nulls in the recordset). Likewise if I place "True" or "False" I get the
correct records.
I have an option group on a form which has "Yes" and "No" radio buttons, but
whose default value is Null. What I'm trying to do is get the underlying
query to deliver records based on the user selection in the option group. If
one of the radio buttons is selected, the form's records will reflect that
selection. But the form will open with that group's value set to Null and I
want to deliver all the records, both true and false. So I have the following
criteria for the "Wiring" field in the query, which of course doesn't work:

IIf(IsNull([Forms]![frmNewMatrix]![grpWiring]),True Or False,[Forms]!
[frmNewMatrix]![grpWiring])

--
Message posted via http://www.accessmonster.com
Nov 13 '05 #1
7 7650
PS:

The value of the radio buttons (and consequently, "grpWiring" ) - "Yes" = -1,
and "No" = 0.

--
Message posted via http://www.accessmonster.com
Nov 13 '05 #2
"Bill Reed via AccessMonster.c om" <fo***@AccessMo nster.com> wrote in message
news:50******** ***@AccessMonst er.com...
PS:

The value of the radio buttons (and consequently, "grpWiring" ) - "Yes"
= -1,
and "No" = 0.

I would be tempted to ditch trying to do this on the query grid and try some
code in the in the option group's 'on update' event (untested):

If Me.grpWiring = 0 Then
Me.Recordsource = "qryNo"
Else
Me.Recordsource = "qryYes"
End If

You'd need three queries (Yes, No and All) but consider this - what if your
user want to show all records *after* making a selection in your option
group? You can't "null" the OG without re-opening the form, so maybe the
"All" condition should be a third selectable option in the group.

Hope this makes sense!

Regards,
Keith.
www.keithwilby.com
Nov 13 '05 #3
Yes, I was just trying to avoid that. There are 4 other option groups on the
form! Although they are not boolean and might be more accommodating in terms
of query criteria (although I'm not sure I'll ever find a solution to "all of
the above" in the option group).

Thanks for your suggestion,

Bill

--
Message posted via http://www.accessmonster.com
Nov 13 '05 #4
I found another post dealing with this and have a solution that works... sort
of! I use the following in the criteria of the query in the boolean "Wiring"
field:

Like IIf([Forms]![frmNewMatrix]![grpWiring]=1,"*",[Forms]![frmNewMatrix]!
[grpWiring])

When I have the form open, if grpWiring is the default selection of 1 ("Both")
the query returns all the records (hooray). Likewise, "Yes" (-1) and "No" (0)
return the right records. The problem is, it's the underlying query of the
form, but the form doesn't display ANY records!

Bill

--
Message posted via http://www.accessmonster.com
Nov 13 '05 #5
Bill Reed via AccessMonster.c om wrote:
(although I'm not sure I'll ever find a solution to "all of
the above" in the option group).


If you don't, your users *will* ask you for an "all of the above"
option, I guarantee it. Keith's post is the way to go. You need to do
some coding to get around this. The other method you're suggesting is a
bandaid solution and more trouble than it's worth.

Actually, by far the best way, in my opinion, is to write the SQL you
want in code, based on your user's choices. In other words, let them
click and choose from option groups and whatever you have there to their
hearts' content. Then, when they press a button, a procedure rewrites
the SQL for the underlying query. This way, you have one query, not
several, but the where clause is rewritten, depending upon the choices
made.
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Nov 13 '05 #6
"Bill Reed via AccessMonster.c om" <fo***@AccessMo nster.com>
wrote in news:50******** ***@AccessMonst er.com:
I found another post dealing with this and have a solution
that works... sort of! I use the following in the criteria of
the query in the boolean "Wiring" field:

Like
IIf([Forms]![frmNewMatrix]![grpWiring]=1,"*",[Forms]! [frmNewMat rix]! [grpWiring])

When I have the form open, if grpWiring is the default
selection of 1 ("Both") the query returns all the records
(hooray). Likewise, "Yes" (-1) and "No" (0) return the right
records. The problem is, it's the underlying query of the
form, but the form doesn't display ANY records!

Bill


so you have the form just operate as a selector to determine the
query? Or is it that the query works, but doesn't repopulate the
form?
--
Bob Quintal

PA is y I've altered my email address.
Nov 13 '05 #7
I didn't get around to thanking you all for your help.

THANK YOU!!
I ended up following Keith's advice in the end.

Bill Reed wrote:
PS:

The value of the radio buttons (and consequently, "grpWiring" ) - "Yes" = -1,
and "No" = 0.

--
Message posted via http://www.accessmonster.com
Nov 13 '05 #8

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

Similar topics

35
3383
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.
7
2192
by: Aaron | last post by:
Complete code follows. I am new to .NET programming (and programming in general) and I am having a difficult time understanding how to fill a variable in one sub, and then access it from another. I have tried declaring them as shared, public, friend, etc and I always get an error stating that something is not valid on a local variable declaration. For example, in the following code for Sub DataGrid_Select, I have CurrentID and...
1
1799
by: Joe Van Meer | last post by:
Hi all, I have an app that currently runs through 3 seperate stored procedures each returning a count of records. What I would like to do is combine these calls into one call, however I am having an issue getting the output parameters' values after execution. Here is a snipit of code that calls one for simplicity's sake: I think I am close, i was under the impression I could use the datareader to get at it, but is is always returning ...
6
5470
by: InnoCreate | last post by:
Hi everyone. I've recently written a classic asp website which uses an MS Access datasource. I know this is less than an ideal data source as it has limited functionality. I have a search form on my website which allows users to define parameters and return results accordingly. The problem i have is a need to return these results in a random order each time. With SQLServer i know NEWID() would do the trick - used this many times before...
11
2649
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 remaining fields are checkboxes, which allows the user to select true/false for each record in the text field. I.E. Field Txt Chkbx1 chkbx2 chkbox3 Eat Apples True False True Now, how to I loop through this table, for each...
13
2251
by: agent-s | last post by:
I have a function, generally described as so: def function(args): if condition: if condition2: function(args+1) elif condition3: print "text" return True else:
13
2548
by: Karl Groves | last post by:
I'm missing something very obvious, but it is getting late and I've stared at it too long. TIA for responses I am writing a basic function (listed at the bottom of this post) that returns data from a query into an array. The intent is that the following code:
0
1291
by: =?Utf-8?B?UHVjY2E=?= | last post by:
I Have the following in my own library project and I call it from my C# application twice each time to get Unix group account information and user account information. But it would return different number of records (lines of data read), sometimes 0 records without any of my message, and there doesn't seem to be a pattern to be found. Can someone have a look and see if any of my code could possbly cause this? Thanks. static...
3
6650
rsmccli
by: rsmccli | last post by:
Access 2002 Hi. I have a command button that will "approve" all records currently being looked at by an "approver". For some reason, even though there are multiple records that exist in the recordsetclone, EOF is returning true. I think this may have something to do with the sort order of the underlying query, but I'm not sure; at any rate, I don't want to change the sort order. I thought you had to check for BOF and EOF, or at least EOF before...
0
8623
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
8562
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9113
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8830
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8820
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5837
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4575
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2997
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 we have to send another system
2
2265
muto222
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.