Trouble disabling a check box

kcolbert01

Registered User.
Local time
Today, 12:29
Joined
Jan 13, 2003
Messages
36
I have a check box that I would like to be disabled if the text in another field is 82 or below - and if that same field is 83 or above I would like the check box to be enabled. The code I am using is:

If Me.PerformancePoints <= 82 Then
[Check207].Enabled = False
Else
If Me.PerformancePoints >= 83 Then
[Check207].Enabled = True
End If
End If

I have been able to lock the check box and make it disapper but when I try to disable it I get .runtime error '2101'.

Can anyone tell me what I'm doing wrong?

Thanks:confused:
 
I'm not sure what you mean by "try to lock the check box and make it disappear", because the code you posted doesn't doesn't lock or make it invisible. But here is what I would do:

Set the check box control's Visible property to no.

On the afterUpdate event of me.performancepoints, use the code you posted:

If Me.performancepoints <= 82 Then
Me.Check207.Enabled = False
ElseIf Me.performancepoints >= 83 Then
Me.Check207.Enabled = True
me.check207.visible = true
End If


Then, in the OnCurrent event of the form, place this code:

If Me.NewRecord Then
Me.Check207.Visible = False
Else
Me.Check207.Visible = True
End If

I don't get any errors when I used this on my test db.

HTH
E
 
Thanks so much for that - it worked like a charm!
 

Users who are viewing this thread

Back
Top Bottom