DataBase - Yes/No Data Types

Asked By Peter Marshall
17-Apr-07 08:28 AM
I have defined a Yes/No data type field with a Default Value of nothing
(neither Yes nor No).  However, when records are created without indicating
Yes or No for that field and I query the Yes/No field, they act as if they
are a No, when in fact I thought they would be a null.  What's the trick
with Yes/No fields?

Peter Marshall
Manager Information Services
Ohio Coatings Company
(740) 859-5560 office
(304) 281-7404 cell
Microsoft Access
(1)
XP
(1)
TripleState
(1)
Vista
(1)
MVP
(1)
CellThis
(1)
JET
(1)
FBF
(1)
  JerryWhittl replied...
17-Apr-07 09:54 AM
This might be a Mission Impossible. A Yes/No field can contain only two
values: Yes or No. If you don't put anything in them, they default to No
(which is actually stored as 0).

Access does support triple state checkboxes but not at the table default
level. You can read more about it here:

http://www.databasedev.co.uk/triplestate_checkbox.html

Personally I think that this is a misuse of Yes/No fields as boolean logic
says that it's one or the other. You might want to consider an Option Group
instead if there can be three values.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.
  Allen Browne replied...
17-Apr-07 10:16 AM
As Jerry explained, the Yes/No data type in Access is capable of handling 2
states only. Null is not supported.

To get a 3-state field, use a field of type Number, size Integer, with the
Display control set to Check Box, and the check box's TripleState property
set to Yes. In Access 2003 or 2007 on Windows XP or Vista, you may want to
turn of Windows Themed controls: otherwise you cannot see an visible
difference between False and Null.

JET's inability to handle nulls is a major problem in Access. Of course, you
still get Null in Yes/No fields (e.g. in a query with an outer join.) If you
then try to operate on the yes/no field, Access will crash. Or if you are
lucky, it just gives senseless errors such as this example:
http://allenbrowne.com/bug-14.html

It may be wise to avoid yes/no fields all together, and use Integer fields
instead, so as to avoid these bugs and crashes.

--
Allen Browne - Microsoft MVP.  Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
Create New Account
help
Microsoft Office 2010 DataBase Hi, Is there any way you can get Microsoft Office 2010 in xp? Access Discussions Microsoft Office Access MVP Co author Microsoft Access (1) Windows XP (1) Access 2010 (1) Office 2010 (1) Microsoft Office 2010 (1) Larry
AccessXP to Access2007 DataBase I try to open a database designed in Microsoft Access XP , in Microsoft Access 2007. All forms and tables seems to be ok but NO COMMAND THAT I WRITE IN VBA is working. No command button Nothing!! Access Tables DB Design Discussions Access 2007 (1) Office (1) VBA (1) XP (1) Database (1) AccessXP (1) Access2007 (1) χρήστης (1) No
Multiple Queries for Microsoft Access Report DataBase I am using Microsoft Access XP. I have three queries that I would like an Access Report to pull data from. I have been getting difficulty putting these together. They all all lined up. I would like the results to be exported to Excel when completed. Access Reports Discussions Office (1) Excel (1) XP (1) EnrollmentID (1) PersonID (1) ClassID (1) Report (1) EnrollmentDate (1) It all starts with
DataBase I am working on a customers site putting in a new system. They use Microsoft Access XP on all their computers. When I hooked up the new system and added it to the workgroup, we got this message when trying to access the database. Microsoft Access Cannot open this file. This file is located outside your intranet or on an untrusted site. Microsoft Access will not open the file do to potential security problems. To open the file, copy
deployment issues of Access XP, Access 2003, and Access 2003 DataBase On my advice, a long time ago, a customer purchased the Access XP developer edition. That special Office XP version of Access was supposed to allow the Access developers to deploy Access XP applications within their organizations