Setting True/False on a CheckBox (1 Viewer)

alktrigger

Aimless Extraordinaire
Local time
Today, 10:31
Joined
Jun 9, 2009
Messages
124
I am trying to set the value of a Checkbox inside a If/Then function in the Form_Load() function, but I keep getting a run time error.

What is the single line of code that will set my check box to true/false?
I expect something along the lines of chkSent.value = True but it offers me Run Time Error 2448 "cannot assign value to this object"

I know this is simple, but it has escaped me. Suggestions would be much appreciated!
 

wazz

Super Moderator
Local time
Today, 22:31
Joined
Jun 29, 2004
Messages
1,711
remove .Value, i think.
 

alktrigger

Aimless Extraordinaire
Local time
Today, 10:31
Joined
Jun 9, 2009
Messages
124
Its giving me a whole different RTE '-2147352527 (80020009)'
 

wazz

Super Moderator
Local time
Today, 22:31
Joined
Jun 29, 2004
Messages
1,711
yeah, that was kind of a silly idea.
could it be the if/then part?
maybe set up some error handling on the form's error event and see what msg you get.
 

alktrigger

Aimless Extraordinaire
Local time
Today, 10:31
Joined
Jun 9, 2009
Messages
124
Fixed by copying a working checkbox from another form
 

wazz

Super Moderator
Local time
Today, 22:31
Joined
Jun 29, 2004
Messages
1,711
i was about to say it sounded messed up and try replacing it...
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 09:31
Joined
Feb 28, 2001
Messages
27,223
How about [chkSent] = TRUE ( or FALSE)

What you wrote using chkSent (without the brackets) looks like setting a variable name. If you don't have Option Explicit then you not only set the value but actually CREATED the variable in which you set that value.
 

boblarson

Smeghead
Local time
Today, 07:31
Joined
Jan 12, 2001
Messages
32,059
I tend to use Me.chkCheckBox = True

with the Me. to explicitly say I am looking for a control on my form.
 

Users who are viewing this thread

Top Bottom