
Signature
Brent Spaulding | datAdrenaline | Access MVP
> To avoid the problem of Null BIT fields, set the column Required
> property to Yes/True and set the Default value to 0 ....
There can be other problems with bit fields used from Access due to the fact
that True in an Access yes/no is stored as negative one and a bit field
stores True as Postive one. I have seen filters and criteria get it wrong
because of this.
I ran into these issues way back with SQL Server 6.5 before they were even
allowed to contain Null.
I always use integer fields for this now on the SQL Server. You can bind
them to CheckBoxes and such just like bit fields and they have none of the
problems.

Signature
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Tammy F - 29 May 2008 14:09 GMT
Thank you - I knew that was the problem - but didn't think to change the
field type as a solution. I did what Brent suggested - default to 0.
Tammy
> > To avoid the problem of Null BIT fields, set the column Required
> > property to Yes/True and set the Default value to 0 ....
[quoted text clipped - 10 lines]
> them to CheckBoxes and such just like bit fields and they have none of the
> problems.
Brent Spaulding (datAdrenaline) - 30 May 2008 06:15 GMT
Hey Rick ---
Yes the 1, 0 mixed with True / False can sometimes lead to "issues". The
technique you mention is a good one. What I do is just adopt a policy of
how I will set up my criteria. In other words, I know the most (if not all)
applications and languages define 0 to be False, and NOT 0 to be True. What
that does is open the door to the value True is assigned (Access: -1; SQL
Server 1; other apps ... but NOT 0). That adherance to the definition of
False is 0 and True is Not 0 is what allows us to create VBA like this:
If Len(Me.txtMyText) Then
'Do True Part
Else
'Do False Part
End If
So ... on to how I handle this possibility ... For virtually universal
compatibility I test for a False condition with =0 and a True condition with
<> 0

Signature
Brent Spaulding | datAdrenaline | Access MVP
>> To avoid the problem of Null BIT fields, set the column Required
>> property to Yes/True and set the Default value to 0 ....
[quoted text clipped - 10 lines]
> them to CheckBoxes and such just like bit fields and they have none of the
> problems.
Rick Brandt - 30 May 2008 12:23 GMT
> Hey Rick ---
>
[quoted text clipped - 15 lines]
> compatibility I test for a False condition with =0 and a True
> condition with <> 0
Yes that is exactly what I do, but... You still have to put up with the fact
that many user-initiated actions cannot always be so controlled. Simple
menu choices like applying a filter on the current value or "excluding" the
current value don't work, filter by form doesn't work, etc.. Usign an
integer just makes all of that go away.

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