Default values

  • Thread starter Thread starter rblivewire
  • Start date Start date
R

rblivewire

I hae a form where everything on the form is set to appear as null when
inputting a new record. I have a yes/no field that I made a combo box.
My problem is as soon as I fill out anything on the form, all of the
combo boxes revert to no instead of staying blank until the user fills
this in. Is this an Access default or is there some way to fix this?
 
A major limitation of JET (the data engine in Access) is that it's Yes/No
fields cannot be Null. They are Yes or No only. They cannot be left blank.

You can work around this problem by opening your table in design view, and
changing the field from YesNo to Number. In the lower pane, set the Field
Size to Integer, and remove the 0 from the Default Value property. Access
uses -1 for True, and 0 for False, so the integer field will use those same
numbers. But the integer field can be null, so your field can now hole -1,
0, and Null, the 3 values you need.

Since you are using a combo on your form, and the combo has no default
value, and the field in the table has no default value, the combo will
remain blank until the user chooses Yes or No. (You may need to modify the
RowSource of the combo so it understands the values correctly.)

If you did want to use a check box bound to a Number field to enter
yes/no/null, you need to set its TripleState property to Yes. If you are
using Access 2003, you will not see the 3 states clearly unless you uncheck
the box under:
Tools | Options | Forms/Reports | Use Themed controls.
 
Back
Top