views:

598

answers:

5

I was wondering if there is a better way to cope with MS-Access' inability to handle NULL for boolean-values other than change the column-data-type to integer.

A: 

Not that I've found :( I haven't programmed Access in awhile, but what I remember involves quite a lot of isNull checks.

Aaron
Yes, Access can handle Null values for other data types, but when I link a table from a DB with boolean-types, Access treats Null like False.
Florian
+2  A: 

I think you must use a number, and so, it seems does Allen Browne, Access MVP, in a response dated 17-Apr-07 10:16:35. http://www.eggheadcafe.com/software/aspnet/29743570/yesno-data-types.aspx

Remou
Thanks Remou, there are some good tips on Allen Browne's site :)
Florian
If you enjoy Allen Browne, you may also like Tony Toews. He is particularly good on corruption: http://www.granite.ab.ca/accsmstr.htm
Remou
A: 

Cannot delete my wrong answer ... sorry

Philippe Grondier
A: 

I think it depends on how you want your app/solution to interpret said NULLs in your data.

Do you want to simply "ignore" them in a report... i.e. have them print out as blank spaces or newlines? In that case you can use the handy IsNull function along with the "immediate if" iif() in either the SQL builder or a column in the regular Access query designer as follows:

IIF(IsNull(BooleanColumnName), NewLine/BlankSpace/Whatever, BooleanColumnName)

On the other hand, if you want to consider the NULLs as "False" values, you had better update the column and just change them with something like:

Update table
SET BooleanColumnName = FALSE
WHERE BooleanColumnName IS NULL

BKimmel