[AccessD] Very interesting quirk in table design...

Drew Wutka DWUTKA at marlow.com
Tue May 13 19:42:55 CDT 2003


I just noticed something tonight.  I had to go into an existing table and
add a few fields.  One field was numeric, then I was going to add two Yes/No
fields.  I did this.  The numeric field was blank/null for all existing
records.  However, I wanted a Yes/No/Not Answered for the Yes/No fields, so
I dropped one of them, and changed the other one to a byte number (1-yes,
2-no, 4-Yes, 8-No) which will let me know the answer for both and whether
they were answered at all.  When I looked back at the datasheet view, the
byte field (which was a yes/no) was all 0's, and the number field was still
all blank.  

So I hypothesized that by setting a Yes/No field, you had either 0 or -1
(maybe 1, I don't remember), but since a Yes/No field only has two possible
values, there was nothing for null, so each field is automatically populated
with 0 or -1.  By switching that field to a number field, it tried to
'convert' the data in those fields, which it did successfully to 0. 

So to prove this, I went into design for that table, changed my 'null
filled' number field to Yes/No, hit save, changed it back to number, and hit
save again.  Whalla, went into datasheet view, and no I had all zero's in my
number field.

Pretty interesting eh?  (Or do I just need some sleep?)

Drew


More information about the AccessD mailing list