Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 16th, 2005, 05:23 PM
Registered User
 
Join Date: Feb 2005
Location: Hobart, Tasmania, Australia.
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?

Reply With Quote
  #2 (permalink)  
Old February 17th, 2005, 12:38 PM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Hi,

   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.

HTH

mmcdonal
Reply With Quote
  #3 (permalink)  
Old February 17th, 2005, 06:08 PM
Registered User
 
Join Date: Feb 2005
Location: Hobart, Tasmania, Australia.
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,
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.

Thanks



Reply With Quote
  #4 (permalink)  
Old February 20th, 2005, 03:10 PM
Authorized User
 
Join Date: Oct 2003
Location: Cleveland, OH, USA.
Posts: 75
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.

Warren
Reply With Quote
  #5 (permalink)  
Old February 21st, 2005, 06:25 PM
Registered User
 
Join Date: Feb 2005
Location: Hobart, Tasmania, Australia.
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.

Regards

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 06:26 AM.


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