PDA

View Full Version : Solved: Checkboxes... huh?



belly0fdesir
06-27-2007, 04:33 PM
I have several checkboxes and in the VBA code attached to one of my buttons, I refer to these checkboxes. When I insert a breakpoint, the checkboxes are always showing as null... I need them to show as "True/False" or "1/0" or ANYTHING other than null... Can someone help me with this?

Thank you in advance,

-b0d

OBP
06-28-2007, 03:22 AM
In the Form's "On Current" event set the check boxes to 0 when they are not already set -
if isnull(me.checkbox1) then me.checkbox1 = 0

mattj
06-28-2007, 08:13 AM
Just FYI, even when the "Triple State" property for a checkbox is set to No, if the checkbox has not been checked or unchecked, its value is always Null

OBP
06-28-2007, 09:17 AM
Matt, ?? :wot

If you set the checkbox to 0 whether it has previously been checked or not it still returns 0.

mattj
06-28-2007, 09:25 AM
OBP - you are correct. I was just attempting to say that checkbox that has not been explicitly set to 0, and that has never been checked will always return a value of Null. For example, place a check box on a form - go to the Immediate window and type debug.print forms!formname!checkbox name, the result will be null...
Sorry for the confusion

OBP
06-28-2007, 09:27 AM
Matt, yep I agree, hence my suggestion. :thumb

geekgirlau
06-29-2007, 12:02 AM
I wouldn't even bother to set them on loading the form - you can either set the default value of the checkbox as 0, or when checking use nz(me.checkbox1,0).