Checked box automatically checks for subsequent records

D

Darcy

I created a form with 'dummy' checked boxes.

We wanted the form to mimic a survey. The survey had yes-no questions with
the answers 'yes' and 'no' as separate boxes next to each other horizontally.

Question: Yes
No

I therefore created one checked box to feed into the table as a binary
'yes-no' (this one was labeled 'yes') so that checking the box resulted in a
'yes' and leaving the box blank resulted in a no. The box would be left
blank if the person entering the data clicked the 'no' box right next to it
(the dummy box).

The dummy box, which is not associated with any value or variable, is
presenting us with two issues. 1) it's a different color than the other
boxes (a blue grey) and more importantly 2) checking the box results in all
subsequent records also being checking.

I would appreciate any advice on how to solve those two issues! Plus, any
suggestions on how to create 'dummy' boxes for future forms (a bit late to
change this one...).

Thanks!!
 
X

XPS350

I created a form with 'dummy' checked boxes.

We wanted the form to mimic a survey.  The survey had yes-no questions with
the answers 'yes' and 'no' as separate boxes next to each other horizontally.

Question:                                      Yes                          
   No

I therefore created one checked box to feed into the table as a binary
'yes-no' (this one was labeled 'yes') so that checking the box resulted in a
'yes' and leaving the box blank resulted in a no.  The box would be left
blank if the person entering the data clicked the 'no' box right next to it
(the dummy box).

The dummy box, which is not associated with any value or variable, is
presenting us with two issues.  1) it's a different color than the other
boxes (a blue grey) and more importantly 2) checking the box results in all
subsequent records also being checking.

I would appreciate any advice on how to solve those two issues!  Plus, any
suggestions on how to create 'dummy' boxes for future forms (a bit late to
change this one...).

Thanks!!

I do not have a solution for the dummy boxes all being checked.

For the future you can consider to use radio buttons instead of check
boxes. You don't need dummy boxes then. Both the yes and no button
will be associated with the table field.

Groeten,

Peter
http://access.xps350.com
 
J

John Spencer

The problem is that an unbound control in a continuous form is really just ONE
control shown many times. So you check or uncheck that one control, all the
other "views" of that control change.

Also, unless you set the control to have a default value of 0, it will have a
value of null until it is checked. That is why the checkbox control appears
to be greyed out.

If you want to have the choice of entering Yes or No or leaving the item
blank, your best bet is probably to use an option group with two checkboxes
and bind the option group frame to your field.

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
 
D

Duane Hookom

You might want to consider binding your answers to an option group consisting
of check boxes with the yes value of -1 and the no value of 0.

You can't really use unbound "dummy" controls in a continuous form. Every
instance of the control will have the same value.
 
K

KenSheridan via AccessMonster.com

A way to do it which allows you to size and colour the 'check boxes' however
you wish is:

1. Include a check box control bound to the field in question and set its
Visible property to False (No).

2. Add two text unbound box controls as the 'check boxes', formatting them
as desired and using whatever character you wish as the check mark (the
WingDings character 252 is the usual one).

3. As the ControlSource of the text boxes use expressions which show the
character of choice or a zero-length string depending on the value of the
bound check box, e.g. for the 'Yes' box:

=IIf([chkMyBooleanField],Chr(252),"")

and for the 'No' box:

=IIf([chkMyBooleanField],Chr("",252))

4. Overlay the two text boxes with a single transparent button and put code
in its Click event to reverse the value of the bound check box.

When the user clicks on one of the dummy 'check boxes' they are in fact
clicking the transparent button, so the value of the Boolean field reverses,
and the two dummy 'check boxes' update accordingly.

As it happens I did produce a little file with a form which demonstrates
these 'dummy check boxes' many years ago for a magazine column which a
contact of mine wrote. It just showed differently formatted 'check boxes'
rather than Yes/No pairs as in your case, but I've just made a copy of the
form and amended it slightly so it acts in the way you describe; so if you'd
like a copy drop me a line at:

kenwsheridan<at>yahoo<dot>co<dot>uk

Ken Sheridan
Stafford, England
 
K

KenSheridan via AccessMonster.com

PS: The DefaultValue property of the bound check box control should be set
to False in the form. A check box bound to a Boolean field is Null until the
user begins to edit a new record, but as in this case no data is being
changed other than that of the Boolean field itself, it is necessary fro the
control to be False to start with for its value to be correctly reversed by
the code.

Ken Sheridan
Stafford, England
 
D

Darcy

Thank you, Peter.
I am completely new to Access, and having trouble figuring out which is the
radio button (even after searching through help). Is that the option button?
I can't seem to find an object that gives me two objects instead of one
(with clicked being yes and blank being no)

Groetjes
Darcy
 
D

Darcy

Thank you, John.
I did change the default and solved the color issue. Thanks!

I played around with having an option group with two checkboxes. I
understand ti now, somewhat. I'm still not sure how to bind the group option
to the field.
D.
 
X

XPS350

Thank you, Peter.
I am completely new to Access, and having trouble figuring out which is the
radio button (even after searching through help).  Is that the option button?
 I can't seem to find an object that gives me two objects instead of one
(with clicked being yes and blank being no)

Groetjes
Darcy

I am not sure about the proper name in english because I use a dutch
version of Access. You place a "groepsvak" (= OptionGroup?) on your
form using the wizzard that will guide you through the proces.

A radiobutton is a round white button that turns black when you select
it. The other buttons in the group turn white when you do that.

Later I realised that you can also use check boxes in an optiongroup.
As mentioned the good thing about an optiongroup is that all boxes/
buttons in the optiongroup are associated with one table field. Every
box or button represents a value (Yes or No in your case).

Peter
http://access.xps350.com
 

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