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

Stuart McLachlan stuart at lexacorp.com.pg
Tue May 13 20:12:46 CDT 2003


On 13 May 2003 at 19:42, Drew Wutka wrote:
> 
> 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?)
> 

A Yes/No field can only have  two values Yes or No, not 3 values 
(Yes, No, Null/Unknown)

That's why you get the annoying behaviour of multiple bound Yes/No 
fields on a form (assuming your form is bound <g>). 

Set the field Required Property to "NO" and the default value to 
"NULL"  and on your form, set the Checkboxes to TripleState.

When you go to a New record, the check boxes are grey (Null), but as 
soon as you start to enter any data, they ALL become False (ie 
unticked). When you try to cycle through the values of one of  
checkbox with the space bar or mouse, you get an error when you try 
to set it to Null ("The value you enterd isn't valid for this field")

The only way to have a TripleState field with a checkbox is by making 
the field type numeric :-(







-- 
Lexacorp Ltd
http://www.lexacorp.com.pg
Information Technology Consultancy, Software Development,System 
Support.





More information about the AccessD mailing list