Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CheckBox problem 1

Status
Not open for further replies.

SidLancing

Programmer
Jun 15, 2004
31
US
I have a Check box name ReSupply in a form that is to be checked if new supply is needed. The problem is when it is checked all records in the DB become Checked... If I uncheck it then they all become unchecked. I went back and double checked the settings and realize that the controlsource was empty...so I corrected it and now that the Resupply field is the controlsource I'm unable to check or uncheck it.Resupply has a field type as YES/NO ...
Any idea what could be causing this?
 
Change the format for the field in your table to number instead of Yes/No, and just put yourself a note that states 0 = Yes, 1 = No, or whatever the case as to which is which.. the checkbox returns a numeric value, so it won't match up with a yes/no table value.

Stephen [infinity]
"Jesus saith unto him, I am the way, the truth, and the life:
no man cometh unto the Father, but by me." John 14:6 KJV
 
Of course, then, you could just use some sort of conditional statement(s) to act on whether it is yes or no (if needed) for certain values.. Or if you wanted to query off the data of say, all that said "Yes", then you could just select that field in the query with the criteria 1 or = 1.

Stephen [infinity]
"Jesus saith unto him, I am the way, the truth, and the life:
no man cometh unto the Father, but by me." John 14:6 KJV
 
Thank you Stephen.. changing the value as Numeric did allow me to check and uncheck the box. If you don't mind however I have 2 more questions
1.)Is there another type of control that I could've used to say Yes/NO and that would be stored as YES/NO

2.)How can I specify positive numbers only in that field?... It's not an absolute must but would prefer to save a 1 when it's checked as opposed to -1 which is what's happening now. I tried select Integer instead of Long Integer for that field and it made no difference.

Thanks
Sid
 
Yes, if you have Yes/No format set to field in table, just use a combo box, and link it to that field, it will automatically give Yes/No as the options. I use it myself that way..

Stephen [infinity]
"Jesus saith unto him, I am the way, the truth, and the life:
no man cometh unto the Father, but by me." John 14:6 KJV
 
Usually one uses check boxes. The "value" delivered from a check box corresponds with a Yes/No field - True/False (-1,0)). If you have a Yes/No field in your field list, and drag-n-drop it on the form, what do you get? Does it work? I don't know why it didn't work in your setup, but often recreate (or reinherit - delete and fetch it from the field list) a control makes things work.

Else you could use the toggle button or option button.

To get positive values from Yes/No fields, just use the ABS function, as in using the following in a controlsource of a text control:

[tt]=abs(sum([YesNoField]))[/tt]

which would count the number of True (-1) occurances in the current forms recordset.

Roy-Vidar
 
Thanks Stephen and Roy ... I changed the field to YES/NO and now the table actually has the check box in it (Checked or unchecked) depending on the value that I picked. I thought I'd see a Yes or No but I guess 2000 doesn't save the data that way.
I want to try the combobox but I do have a question... because when creating a combobox there's usually a prompt to choose
I want the combobox to lookup the values in a table or query

or

I will type in the values that I want

or

Find a record based on the value that I selected in the combobox

If I choose the first option it would mean having a table with YES and NO in it.... the other 2 options are just as strange...
If you don't mind can you send more detail on how this would be implemented in a combobox.

Again
Thank you both for all your help
 
SidLancing, feel free to take a look at the FAQ area in this forum, as an entire section is devoted to combo.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
For the display of the Yes/No field, take a look in the table design view. In the format property of a Yes/No field, one can select between True/False, Yes/No, On/Off, which doesn't rally change anything unless you also alter the Display Control property from the Lookup tab, where you can select between Check Box, Text Box and Combo Box.

Selecting Combo Box there, specifying Value List as Row Source Type, Entering Yes;No as Row Source would give something like that, but I've never used any of them, I prefer the three "ordinary" Yes/No displays, Check Box, Opion Button and Toggle Button.

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top