473,796 Members | 2,867 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Filter by form problem with Yes/No Data and SQL Server

Using Access 2003 front end; SQL Server 2005 Back end:

I have a complex form that has lots of data fields including about
thirty or so checkboxes storing Yes/No data that I would like my users
to be able to use the Filter by Form functionality with to create a
"Custom" query.

This works perfectly fine when I filter on a text field. Also, this
works perfectly fine for all data with an Access Back end. When I use
boolean data and my SQL server back end, however, the filter stops
working. I understand that the SQL server stores the Yes as "1" while
Access, and my "Filter Form" uses "-1" for Yes.

Clicking on a box in the Filter by Form creates a Me.Filter string
which looks like "CheckBox7 = -1". I don't really understand this,
since the checkbox on the actual Form stores a value of 1 in the SQL
table.

Is there a way I can get the "Filter By Form" to work with Boolean
Data?

Thanks!
Mar 28 '08 #1
5 3685
On Mar 28, 10:40*am, Jim Mandala <mand...@rci.ru tgers.eduwrote:
Using Access 2003 front end; SQL Server 2005 Back end:

I have a complex form that has lots of data fields including about
thirty or so checkboxes storing Yes/No data that I would like my users
to be able to use the Filter by Form functionality with to create a
"Custom" query.

This works perfectly fine when I filter on a text field. Also, this
works perfectly fine for all data with an Access Back end. When I use
boolean data and my SQL server back end, however, the filter stops
working. I understand that the SQL server stores the Yes as "1" while
Access, and my "Filter Form" uses "-1" for Yes.

Clicking on a box in the Filter by Form creates a Me.Filter string
which looks like "CheckBox7 = -1". I don't really understand this,
since the checkbox on the actual Form stores a value of 1 in the SQL
table.

Is there a way I can get the "Filter By Form" to work with Boolean
Data?

Thanks!
SQL Server Bit fields are 0 or 1. (I suppose anything bit is 0 or 1
for that matter.) Is that extended to your checkbox on your form?
Don't know but you might try it.
Mar 28 '08 #2
Thanks for the reply. I forgot to mention that I am using ODBC to
connect to the SQL server.

The Checkboxes on the normal Form map to 0's and 1's in the data
table. I.e. True = 1. However, when I use the Access' "Filter By
Form" function, it seems to open a 'copy' of the form. The Checkboxes
on this form automatically create a filter, but every checked Checkbox
creates a True = -1; which is the Access standard for True/False data.

Two different data standards... Same Microsoft... Does Bill Gates have
too much money?

Mar 28 '08 #3
Jim Mandala wrote:
Thanks for the reply. I forgot to mention that I am using ODBC to
connect to the SQL server.

The Checkboxes on the normal Form map to 0's and 1's in the data
table. I.e. True = 1. However, when I use the Access' "Filter By
Form" function, it seems to open a 'copy' of the form. The Checkboxes
on this form automatically create a filter, but every checked Checkbox
creates a True = -1; which is the Access standard for True/False data.

Two different data standards... Same Microsoft... Does Bill Gates have
too much money?
Yep, I've seen this issue and not just in filter-by-form. The only 100%
reliable tests for a bit field from Access is =0 and <>0. Testing for -1
often does not work and testing for 1 often does not work. Yes/No,
True/False, etc., are equally problematic.

When testing a CheckBox *control* bound to a bit field you can usually use
any of the normal tests as you would with an Access table, but when testing
the actual field value just stick with =0 or <>0. They always work.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Mar 29 '08 #4
As the value for False in both cases is 0, structuring your test to use Not
False or <False works well. That, of course, is simply another way of
specifying <0, because the value of the builtin Constant False is 0.

Larry Linson
Microsoft Office Access MVP

"Rick Brandt" <ri*********@ho tmail.comwrote in message
news:3b******** *******@newssvr 19.news.prodigy .net...
Jim Mandala wrote:
>Thanks for the reply. I forgot to mention that I am using ODBC to
connect to the SQL server.

The Checkboxes on the normal Form map to 0's and 1's in the data
table. I.e. True = 1. However, when I use the Access' "Filter By
Form" function, it seems to open a 'copy' of the form. The Checkboxes
on this form automatically create a filter, but every checked Checkbox
creates a True = -1; which is the Access standard for True/False data.

Two different data standards... Same Microsoft... Does Bill Gates have
too much money?

Yep, I've seen this issue and not just in filter-by-form. The only 100%
reliable tests for a bit field from Access is =0 and <>0. Testing for -1
often does not work and testing for 1 often does not work. Yes/No,
True/False, etc., are equally problematic.

When testing a CheckBox *control* bound to a bit field you can usually use
any of the normal tests as you would with an Access table, but when
testing the actual field value just stick with =0 or <>0. They always
work.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com

Mar 29 '08 #5
It looks like I need to completely avoid the Filter by Form function
for my end users to do any searching.
Apr 5 '08 #6

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

Similar topics

1
7852
by: Robert Neville | last post by:
I would like to add filter functionality to my database whether through the Main form or the subform. This question may be rudimentary, yet I have not less experience with filtering data outside from queries. Let me just add that Allen Browne excellent article about this subject may not apply to this scenario on an elementary level. (Here's the link to the article; Filter a Form on a Field in a Subform -...
0
6476
by: CSDunn | last post by:
Hello, I have a problem with field filtering between an Access 2000 Project form (the application is called CELDT), and the report that shows the results of the filter. Both the form and the report are based on the same View addressed in the Record Source of both as 'dbo.CLMain_vw'. The View resides in a SQL Server 2000 database. There are two different problems I am having with filtering: The first involves filtering in the form by date...
7
6289
by: damjanu | last post by:
Hi All; I need little help. I have a datasheet form. I allow user to do 'filter by selection'. My form contains a column with values. As user changes selections, I want to calculate totals. I can do this the first time the form loads.
8
6535
by: dick | last post by:
I am just trying to print/report the results of a "filter by selection" which is done by right-clicking a form, filling in values, and "applying the filter." I have searched the newsgroups, and there are many examples. BUT, they fail sometimes. The techique is to pass the form's Me.filter as the "where condition" in a Docmd.openreport statement in code behind a "print button" on the form.
2
5068
by: Salad | last post by:
I have a log file with a list of records. The log file can be unfiltered or filtered. I have a command button to call a data entry form from the log. At first I was only going to present the record the user selected. Then I thought, what the heck, give the user all of them but start out at the record the user is currently on. If I pass the current filter that resides on the log this causes problems. For example, if the filter is...
0
2246
by: Malcolm Cook | last post by:
I've discovered: Using "File > Print Preview" in a form's datasheet view with a server Filter crashes access after previewing... ....that is, unless ServerFilterByForm has been turned off after applying the filter. See the steps to recreate bug below for details.
2
6688
by: Patrick Gonzalez | last post by:
Is it possible to use the built-in filter functions (ie. "Filter by Selection", etc..) when a form's recordsource has been set to a recordset object during the load event. When I try to do this, I receive the message "Cannot apply filter on one or more fields specified in the filter property". here is the code for the recordset creation: Set conn = New ADODB.Connection Set rsSQL = New ADODB.Recordset
11
6114
by: Bob | last post by:
I am in the process of upgrading an Access database to SQL Server (and climbing that learning curve!). The wizard happily upgraded all the tables and I can link to them OK using ODBC. The application controls allocation of revisions to aircraft maintenance manuals for an airline type operation. In the application there is a form loaded at start-up allowing the user/s to select the records that they are currently interested in from 4...
6
3069
by: Chris Zoper | last post by:
Hello, I have a form that shows a lot of records based on a passthrough query to a SQL Server database. I noticed that the Filter and the Sort property of the form do not properly work, often the filter and sorting are not performed. When I base the form on a query on an Access-table everything works just fine, but when I use the passthrough query nothing happens. Does anyone know how to solve this problem?
0
9525
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,...
1
10169
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
9050
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6785
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
5440
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5569
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4115
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
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2924
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.