TRUE/FALSE convert to checkbox

12-09-2002, 08:34 AM
I have a database value I'm pulling out that is a true or false.
I am wondering if there is a quick way to make that into a checkbox on a form.

I currently have the code checkbox.value = rs!inc
but since rs!inc returns true then it won't check the box.

Do I need to change inc to be a different type of field? Or how do I make this one statement work.

I'm still trying to learn the best way to do things so let me know what you all think.

Thanks for any help.

12-09-2002, 08:38 AM
If rs!inc = True Then
check1.value = Checked

12-09-2002, 08:49 AM
Is there a way I can set it up so I don't have to do that.
I'm trying to model my database and program so that there is a direct correlation between each variable and each field, so if I have to change one or the other that is fine.

12-09-2002, 09:06 AM
' convert -1/0 to 1/0
check1.value = Not (rs!inc - 1)

12-09-2002, 09:11 AM
ooer that did it. Thanks much.

Is there a checkbox.checked property?

Will the checkbox give me a 1 and 0 back when the user edits them? If so can I do a Not(checkbox.value +1) to convert from 1/0 to -1/0 or will I have to put an if statement in there to make it a true or false field?

And would I be better off just making it a number field with a value of 1 or 0?

12-09-2002, 09:20 AM
A boolean field will likely take less space, its probably not a big deal, but if there are a lot of them..

The code to go the other direction is the same:

rs!inc = Not (Check1.Value - 1)

12-09-2002, 10:03 AM
Keep in mind, unlike an OptionButton, CheckBox.Value is not Boolean.

12-09-2002, 10:21 AM
Ok I just made it boolean. It is easier to save the data that way, and easier to retrieve it. Plus it makes for less code in the end. :)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum