Another Question about "How do I add "Yes" to checkbox"!

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Following on from my earlier post...I have encountered a small problem! When
you click the checkbox it enters "yes" in the textbox as requested...but...it
enters "yes" for all records at once!! I want it to only enter "yes" for each
unique record if it is checked and not enter "yes" for them all. What extra
piece of code do I need?

Thanks again!
 
Jimmy,
Your Textbox should be a calculated value that reflects the value
selected in the CheckBox. Right now you probably are using an "unbound"
TextBox so what you put in that field is seen on all records.

Since you have a bound CheckBox to capture the Yes or No value, the
TextBox should only "display" Yes or No in response to those CheckBox
selections.

Remove any code with your CheckBox that sets the value of the TextBox...
there's no need to do that.

Make the TextBox a "calculated" control.
Place this ControlSource in your TextBox... use your own names...

= IIF([YourCheckBox] = True, "Yes", "No")

As you Click/Unclick your Checkbox, the TextBox will always reflect the
proper Yes or No, and each record should display the correct value according
to it's CheckBox value.
hth
Al Camp
 
Following on from my earlier post...I have encountered a small problem! When
you click the checkbox it enters "yes" in the textbox as requested...but...it
enters "yes" for all records at once!! I want it to only enter "yes" for each
unique record if it is checked and not enter "yes" for them all. What extra
piece of code do I need?

This will not work the way you want it to unless the checkbox is bound to a
field in the form's recordsource. Is that checkbox bound to such a field (the
checkbox's "Control Source" property will contain the name of a field from the
form's recordsource)?
 
In my checkbox's properties, the Control field is empty, not bound to anything.
The "=True..Yes No" solution already posted here is not resolving my
problem. All my records still show as being "checked" whenever you check one
of them. They do show "Yes" or "No" according to if you have them checked or
not...but it affects all records still!
Any further ideas guys?!

Thanks
 
As he previously stated, your checkbox must be bound to the record. It must
be a field in your table.

If you have ten records and you check records 1, 4, and 7 how would access
"remember" that if it did not store the value in the table?

Yesterday I told you that your DISPLAY field must be unbound, not the
checkbox field.



Rick B
 
Jimmy,
I agree with Bruce, and my solution took it for granted that your
CheckBox was "bound" to a field in the table, and that the TextBox was only
to "dislplay" the word "Yes" or "No" as a visual aid to the user.
From what I can tell right now, your CheckBox and the Textbox are BOTH
unbound, so that whatever you check will show in all records, and whatever
you enter in the TextBox will show on all records. In other words you have
an unbound checkbox updating the value of an unbound textbox.

I think you need to take a moment to describe... in detail... what you are
trying to accomplish, what controls you have now, and what code you have at
this time.

hth
Al Camp
 
Following on from my earlier post...I have encountered a small problem! When
you click the checkbox it enters "yes" in the textbox as requested...but...it
enters "yes" for all records at once!! I want it to only enter "yes" for each
unique record if it is checked and not enter "yes" for them all. What extra
piece of code do I need?

Thanks again!

I'm *GUESSING* that what you want is to have a checkbox and a textbox,
*both* bound to the same Yes/No field in your Table. Try setting the
controls as follows:

Checkbox
Enabled = Yes
TabStop = Yes

Textbox
Enabled = No
Locked = Yes
Format = Yes/No
TabStop = No


John W. Vinson[MVP]
 
Ok guys here is what I am trying to do with the database...I have 3 different
checkboxes and text boxes contained within a form. I need for each texbox to
show "Yes" whenever the checkbox beside it is clicked e.g. I have a field
named "Complete" that contains a checkbox and a text box and when the empty
checkbox is checked "Yes" appears beside it or "No" if you don't check
it!(it doesn't have to show "No"..blank is fine also)
Currently when you check the box "Yes" appears...but...it also checks and
shows "Yes" for each record! I have about 1100 records and I don't want all
of them showing up complete in an instant! I need for each record to be
independent i.e. not every record may be "checked" complete!

So that is what I need...here is what I have currently code wise...
Textbox name - Text69...Control source - =IIf([Yes]=True,"Yes","No")...All
Event fields are blank
Checkbox name - Yes...Control source - (blank)...All event fields are blank.

This is possibly my problem?..I do not have any field in my table with
"Yes/No" linked to the form. Where do I need to put this field/column and
what should it contain or be linked to...if in fact this is my problem?!

Let me know if you need any more details!

All help/ideas welcome!

Thanks again guys!
 
Jimmy,
You've got to read and follow the advice in our responses!
Three people have told you that the Checkbox MUST BE "BOUND" to a field
in your table in order for it to "hold" the proper value for each record in
your database.

Just forget about the textboxes right now... let's just get the Checkbox
to work properly.

For example...
If I had a database of automobiles, in my table design I'd have a field
called [CDPlayer], and I'd make it a Yes/No field.
On my data entry form I'd place a checkbox called CDPlayer with a
ControlSource of ...
= [CDPlayer].
If a car has a CD Player, I check CDPlayer, if it doesn't I leave it
unchecked. But... because the CDPlayer Checkbox is "BOUND" to a field in
my table, each record can store and retain it's own unique value.

If you have a Checkbox called Complete, it MUST be "bound" to a Yes/No
field in your table called [Complete], or [Done], [NoMoreWorkNeeded]... or
whatever you want to call it.
hth
Al Camp

jimmy dean said:
Ok guys here is what I am trying to do with the database...I have 3
different
checkboxes and text boxes contained within a form. I need for each texbox
to
show "Yes" whenever the checkbox beside it is clicked e.g. I have a field
named "Complete" that contains a checkbox and a text box and when the
empty
checkbox is checked "Yes" appears beside it or "No" if you don't check
it!(it doesn't have to show "No"..blank is fine also)
Currently when you check the box "Yes" appears...but...it also checks and
shows "Yes" for each record! I have about 1100 records and I don't want
all
of them showing up complete in an instant! I need for each record to be
independent i.e. not every record may be "checked" complete!

So that is what I need...here is what I have currently code wise...
Textbox name - Text69...Control source - =IIf([Yes]=True,"Yes","No")...All
Event fields are blank
Checkbox name - Yes...Control source - (blank)...All event fields are
blank.

This is possibly my problem?..I do not have any field in my table with
"Yes/No" linked to the form. Where do I need to put this field/column and
what should it contain or be linked to...if in fact this is my problem?!

Let me know if you need any more details!

All help/ideas welcome!

Thanks again guys!



AlCamp said:
Jimmy,
I agree with Bruce, and my solution took it for granted that your
CheckBox was "bound" to a field in the table, and that the TextBox was
only
to "dislplay" the word "Yes" or "No" as a visual aid to the user.
From what I can tell right now, your CheckBox and the Textbox are BOTH
unbound, so that whatever you check will show in all records, and
whatever
you enter in the TextBox will show on all records. In other words you
have
an unbound checkbox updating the value of an unbound textbox.

I think you need to take a moment to describe... in detail... what you
are
trying to accomplish, what controls you have now, and what code you have
at
this time.

hth
Al Camp
 
I have changed my Complete field in the table to a "Yes/No" format and then
entered =[Complete]as the control source for the checkbox.
Now it will not let me check the box in my Form because it says "Control
can't be edited. It's bound to the expression Complete"! I even made a new
field with a Yes/No format and tried linking to that just in case the
previous one had a naming conflict...but I get the same error mesage!

AlCamp said:
Jimmy,
You've got to read and follow the advice in our responses!
Three people have told you that the Checkbox MUST BE "BOUND" to a field
in your table in order for it to "hold" the proper value for each record in
your database.

Just forget about the textboxes right now... let's just get the Checkbox
to work properly.

For example...
If I had a database of automobiles, in my table design I'd have a field
called [CDPlayer], and I'd make it a Yes/No field.
On my data entry form I'd place a checkbox called CDPlayer with a
ControlSource of ...
= [CDPlayer].
If a car has a CD Player, I check CDPlayer, if it doesn't I leave it
unchecked. But... because the CDPlayer Checkbox is "BOUND" to a field in
my table, each record can store and retain it's own unique value.

If you have a Checkbox called Complete, it MUST be "bound" to a Yes/No
field in your table called [Complete], or [Done], [NoMoreWorkNeeded]... or
whatever you want to call it.
hth
Al Camp

jimmy dean said:
Ok guys here is what I am trying to do with the database...I have 3
different
checkboxes and text boxes contained within a form. I need for each texbox
to
show "Yes" whenever the checkbox beside it is clicked e.g. I have a field
named "Complete" that contains a checkbox and a text box and when the
empty
checkbox is checked "Yes" appears beside it or "No" if you don't check
it!(it doesn't have to show "No"..blank is fine also)
Currently when you check the box "Yes" appears...but...it also checks and
shows "Yes" for each record! I have about 1100 records and I don't want
all
of them showing up complete in an instant! I need for each record to be
independent i.e. not every record may be "checked" complete!

So that is what I need...here is what I have currently code wise...
Textbox name - Text69...Control source - =IIf([Yes]=True,"Yes","No")...All
Event fields are blank
Checkbox name - Yes...Control source - (blank)...All event fields are
blank.

This is possibly my problem?..I do not have any field in my table with
"Yes/No" linked to the form. Where do I need to put this field/column and
what should it contain or be linked to...if in fact this is my problem?!

Let me know if you need any more details!

All help/ideas welcome!

Thanks again guys!



AlCamp said:
Jimmy,
I agree with Bruce, and my solution took it for granted that your
CheckBox was "bound" to a field in the table, and that the TextBox was
only
to "dislplay" the word "Yes" or "No" as a visual aid to the user.
From what I can tell right now, your CheckBox and the Textbox are BOTH
unbound, so that whatever you check will show in all records, and
whatever
you enter in the TextBox will show on all records. In other words you
have
an unbound checkbox updating the value of an unbound textbox.

I think you need to take a moment to describe... in detail... what you
are
trying to accomplish, what controls you have now, and what code you have
at
this time.

hth
Al Camp

In my checkbox's properties, the Control field is empty, not bound to
anything.
The "=True..Yes No" solution already posted here is not resolving my
problem. All my records still show as being "checked" whenever you
check
one
of them. They do show "Yes" or "No" according to if you have them
checked
or
not...but it affects all records still!
Any further ideas guys?!

Thanks

:

Following on from my earlier post...I have encountered a small
problem!
When
you click the checkbox it enters "yes" in the textbox as
requested...but...it
enters "yes" for all records at once!! I want it to only enter "yes"
for each
unique record if it is checked and not enter "yes" for them all.
What
extra
piece of code do I need?

This will not work the way you want it to unless the checkbox is bound
to
a
field in the form's recordsource. Is that checkbox bound to such a
field
(the
checkbox's "Control Source" property will contain the name of a field
from the
form's recordsource)?

--
Bruce M. Thompson, Microsoft Access MVP
(e-mail address removed) (See the Access FAQ at http://www.mvps.org/access)
NO Email Please. Keep all communications
within the newsgroups so that all might benefit.<<
 
I have changed my Complete field in the table to a "Yes/No" format and then
entered =[Complete]as the control source for the checkbox.

Remove the = sign.

John W. Vinson[MVP]
 
Thank you John! That works!
Now I need to sort out the text box problem...

Thanks again

John Vinson said:
I have changed my Complete field in the table to a "Yes/No" format and then
entered =[Complete]as the control source for the checkbox.

Remove the = sign.

John W. Vinson[MVP]
 
Hold on...I think I have sorted it out. Use my original code in the textbox
and since the checkbox is controlled it will only display when it is
checked...and only for that unique record! Duh!!

It seems to working now!!

Thanks to you all for your help, maybe now I can stop pulling my hair out?!!

Hopefully this is the close of this post?!!

let me know if I need any other/different code to ensure complete
compatability?

Thanks again!




John Vinson said:
I have changed my Complete field in the table to a "Yes/No" format and then
entered =[Complete]as the control source for the checkbox.

Remove the = sign.

John W. Vinson[MVP]
 
John,
Hmm... that's odd... I tested that before I suggested it.

I usually don't use the equal sign either, but in a little test database I
have, =[LastName] works just fine as well as a "check" bound field with
=[Active].

Why would the = sign cause a problem?

Thanks,
Al Camp

John Vinson said:
I have changed my Complete field in the table to a "Yes/No" format and
then
entered =[Complete]as the control source for the checkbox.

Remove the = sign.

John W. Vinson[MVP]
 
Why would the = sign cause a problem?

It makes the field non-updateable because Access considers it an
expression rather than a bound control. It would be ok to just
*display* the data, but he was trying to update using it.

John W. Vinson[MVP]
 
Back
Top