View Full Version : Locking a Check Box


popen
04-04-2001, 12:27 AM
Hi. I have a couple of checkboxes on my form, once they are clicked (The Tick appears in them), I want them to be locked so that they cannot be unticked.
Can anybody Help Me ?
Many thanks,

-NEIL L POPE

Atomic Shrimp
04-04-2001, 05:38 AM
In the properties box for the checkbox object, there is a 'locked' property; set this to 'yes'

Mike

popen
04-04-2001, 06:37 AM
Thanks for the reply.
By choosing 'YES' for the 'Locked' option, the whole tick box becomes locked, and cannot be ticked. I want to lock it ONLY after it has been checked (Tick appear).
Any other ideas on this ?

Many thanks.

jblackman
04-04-2001, 06:39 AM
One option to consider is adding code to the "On Load" for the form properties that checks to see if that check box = ture, if true, you can deactivate it so it is locked with the tick mark... ?

AccessUser
04-04-2001, 10:43 AM
In the After Update event for the check box add this code:

me.CheckBox.Enable = False
me.CheckBox.Locked = True

Where CheckBox is the name of your check box.

Atomic Shrimp
04-04-2001, 01:05 PM
Sorry, didn't read your question properly; yes, as AccessUser says, do it in the AfterUpdate event.

Rich
04-04-2001, 02:30 PM
You cannot disable a control while it still has the focus.
You will have to use the form's current event
If Me.Chkbx1=True Then
Me.Chkbx1.Enabled=False
Me.Chkbox1.Locked=True
Else
Me.Chkbx1.Enabled=True
Me.Chkbox1.Locked=False
End If
In the on enter/got focus event of another control put Form_Current and hope your users don't change their minds before entering the other text box.
HTH

popen
04-05-2001, 01:36 AM
Thanks all, I got it to work !
I owe you all a beer !

-NEIL