Checkbox Question

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

Guest

Dear All,

I am embarressed asking this question because I feel I should know the
answer, but which property do I use to programatically change the state of an
unbound checkbox from True to False?

I thought it would be the Value property but I get an error stating that:

err.Number: 2427
err.Description: "You entered an expression that has no value."

I am confused. I seek enlightenment.

Thanks again,

Alastair MacFarlane
 
well, you should be able to just set it directly, as

Me!CheckboxName = False ' or True, or Null for that matter

can you post your code?

hth
 
Tina,

Thanks for the reply, but this is the code that generates the error:

Private Sub chkDetList_MouseUp(Button As Integer, Shift As Integer, X As
Single, Y As Single)
If Me.chkDetList = Unchecked Then
Me.chkDetList = Checked
End If
End Sub

By not specifying a property it is using the "Value" default property and
this is the error that it raises:
err.Number: 2427
err.Description: "You entered an expression that has no value."

Thanks again...

Alastair MacFarlane
 
well, it could be because you're using the MouseUp event, Access may not
like that for some reason. have you tried using the Click event, or the
BeforeUpdate event?
are you really using "Unchecked" and "Checked" in your code? if so, then i
take it they're variables, declared outside the sub. suggest you put a break
on the code and step through it to see if the variables have a value at the
time the code runs.

hth
 
Tina,

It seemed to be a bad Check Box, since the code worked fine with a newly
added Check Box. When I looked at the properties of the original Check Box
there was no click event and and there was only one state (true or false)
when the form was in run mode. It could be set on the load event but at no
other time and once set it would not allow me to change the state.

Very weird. It will just have to remain one of life's mysteries.

Thanks again for your help Tina.

Alastair
 
Back
Top