How can I make an Option Group start as Null?

P

plh

Access 2003
Windows XP
On my form "frmCustOrds" I have an option group in a frame "fraSpecAtt" with two
buttons "optYes" (Option value -1) and "optNo" (Option value 0). When a new
Customer Order is added, I need to have this option group come up with a null
value, that is, with neither button filled. "fraSpecAtt" has as its Data
"SpecFormAtt" which is a "Yes/No" data type. I have tried many things including:
1) Having the default value on the table be "Null"
2) Having the default value on the form be "Null", "=Null", """",
However, it always defaults to zero, that is, with "optNo" filled.
I need this because there is a send mail button that I will leave disabled until
the user has chosen one or the other, "optYes" or "optNo". Users are restricted
to using the my "Add" button to add records, which accomplishes this with the
command DoCmd.GoToRecord , , acNewRec. That is, no navigation buttons.
What am I missing?
-Desperate,
-plh
 
S

storrboy

Have you tried to just delete the DefaultValue in the controls
property sheet (ie no value entered at all)? Works for me, but it
seems you must actually close the form and re-open it for the change
to be visible (at least in A97).
 
M

Mr B

plh,

If you set the value of the group control to nothing all of the options will
appear greyed out.

You have a couple of options AFIK.

One, set the value of your group control to zero and the value of your
options to 1 and 2 respectively. This will require you to change your
routine that checks for Null to check for zero, 1 or 2.

If you just do not want to change your routine that checks for null, you
might try adding a textbox control bound to the field that your group control
is currenly bound to. Have your group control to be unbound. Set the
default value of your new textbox to be null. The use the AfterUpdate event
of your group control to set a value in your textbox. You would then just
check the value of the textbox instead of the group control. The textbox can
be a hidden control so that users would not realize any difference in the
operation of your form.

--
HTH

Mr B
email if needed to:
draccess at askdoctoraccess dot com
 
J

John W. Vinson

"fraSpecAtt" has as its Data
"SpecFormAtt" which is a "Yes/No" data type. I have tried many things including:
1) Having the default value on the table be "Null"

A Yes/No datatype allows ONLY True (-1) and False (0) as values. It is not
possible to store a NULL in a Yes/No field.

If you need to allow for Null, True, and False then I'd suggest using a
Number... Small Integer datatype, and using a validation rule

IN (0, -1) OR IS NULL

John W. Vinson [MVP]
 
M

Marshall Barton

plh said:
Access 2003
Windows XP
On my form "frmCustOrds" I have an option group in a frame "fraSpecAtt" with two
buttons "optYes" (Option value -1) and "optNo" (Option value 0). When a new
Customer Order is added, I need to have this option group come up with a null
value, that is, with neither button filled. "fraSpecAtt" has as its Data
"SpecFormAtt" which is a "Yes/No" data type. I have tried many things including:
1) Having the default value on the table be "Null"
2) Having the default value on the form be "Null", "=Null", """",
However, it always defaults to zero, that is, with "optNo" filled.
I need this because there is a send mail button that I will leave disabled until
the user has chosen one or the other, "optYes" or "optNo". Users are restricted
to using the my "Add" button to add records, which accomplishes this with the
command DoCmd.GoToRecord , , acNewRec. That is, no navigation buttons.


The problem is that the frame is bound to a Yes/No field.
Yes/No fields can only be True or False.

To get what you want you need to change the SpecFormAtt
field in the table to an Integer field.
 
M

Mr B

John and Marshall,

Please accept my appologies for not catching the "Yes/No" field part of the
OP. My mistake.

You are quite correct in your assessment.

Mr B
email if needed to:
draccess at askdoctoraccess dot com
 
P

plh

A Yes/No datatype allows ONLY True (-1) and False (0) as values. It is not
possible to store a NULL in a Yes/No field.

If you need to allow for Null, True, and False then I'd suggest using a
Number... Small Integer datatype, and using a validation rule

IN (0, -1) OR IS NULL

John W. Vinson [MVP]

That works swimmingly, Thank You!
-plh
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top