Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old February 16th, 2005, 05:23 PM
Registered User
Join Date: Feb 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Yes/No Check Box -- fills in "no" without default

I have set up a yes/no group with the standard two check boxes. I have used the wizard and selected that I do not want a default option. In the table I have set the field as not required.

The aim has been to get the user to make a selection between yes/no and leave it blank if there is no selection.

On presenting a new record for data entry the check poxes are filled with a light shade with no entry preselected. However if the record is saved, again with neither box ticked, it is saved as "no" and there after presents as no for editing.

This is not good as a no answer provides misleading information.

How do I ensure an unanswered check box yes/no group remains blank?

Old February 17th, 2005, 12:38 PM
Friend of Wrox
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts


   I am not sure about what you mean here:

"I have set up a yes/no group with the standard two check boxes."

   There is a Yes/No check box (check for Yes, leave blank for No) but I don't know what a Yes/No Group is.

   The user makes a check for yes, and does not make a selection, or can uncheck, for no. This is one control working for one field.

   The default is No, or unchecked, unless you make it Yes.

   I am not sure how user inaction provides misleading information since user inaction means No, which is an affirmative selection.

   If it is not checked, it remains blank.

   Does this answer your question? If not, please elucidate.


Old February 17th, 2005, 06:08 PM
Registered User
Join Date: Feb 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts

Thanks for the response.

In the situation I am dealing with the single check box is not adequate because it does have only two states, either yes/no, on/off etc and will not allow a third - unanswered state.

I thought a way forward was to use Access's wizard to have both a yes and a no button assigned to the one field (tool box - press wizard, group & then drag yes/no field fromm table onto form) would overcome this. It doesn't ... even when there is a yes button & a no button and both are left unchecked when the record is saved it defaults back to no.

If I code a response using the check box based I will have the same problem. Given this is probably a common requirement I assume there is a simple work around, object property change I am missing, etc.

Hope that clarifies.


Old February 20th, 2005, 03:10 PM
Authorized User
Join Date: Oct 2003
Posts: 75
Thanks: 0
Thanked 0 Times in 0 Posts

Is this Yes/No setup on your form a bound to a Yes/No field in a table? Yes/No fields in an MS Access table can only have 2 values of Yes or No only - therefore, only one of the 2 values MUST be stored in the underlying table, not a null value.

IF you are using a bound form with the bound checkbox controls for Yes/No, you can try the following.

There is a work-around if you want to have a NULL value for a Yes/No field. Define the Yes/No table column as type INTEGER and set the value of the "True/Yes" checkbox to -1 (equivalent of TRUE) and the other "False/No" checkbox set to a value of 0 (equivalent of False). Any VBA code or queries that reference the table column should cross-reference True/Yes/-1 and False/No/0 correctly.

Again, a Yes/No type column in MS Access/Jet will only allow the 2 values only - in this case, the integer value will allow a NULL value as well.

Hope that helps.

Old February 21st, 2005, 06:25 PM
Registered User
Join Date: Feb 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts

Thank you for the response. I was hoping that where would be a yes/no/null situation but as you have pointed out this will not happen when the record is saved.

In addition to your work around I have also found that designating the field in the table as text and the form control as yes/no also works.


Similar Threads
Thread Thread Starter Forum Replies Last Post
Default Dynamic Dialog Box peace2007 Javascript 6 September 30th, 2007 04:29 AM
Zoom Box Default Settings SerranoG Access VBA 0 June 22nd, 2006 01:39 PM
check box default value in struts form sridevi Servlets 3 January 15th, 2006 11:13 PM
how to get value from check box..... cici Classic ASP Professional 2 May 15th, 2004 08:35 AM
how to default confirm box to NO in javascript. An Javascript 1 June 8th, 2003 07:34 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.