Locking a control

peljo

Registered User.
Local time
Today, 10:59
Joined
May 24, 2006
Messages
24
I want to lock a control in the subform but i cannot do it.Even though the control brancho is Null, the control cartons is not locked.Can you help me ?

Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(Me!branch0) Then
Me!cartons.Locked = True
End If
End Sub
 
have you tried the code in the forms After update event. Do'nt forget that a locked field can receive focus but you cannot edit the data. Why not try replaced locked with the enabled property. That way you have a visual indication of whether works or not.
 
have you tried the code in the forms After update event. Do'nt forget that a locked field can receive focus but you cannot edit the data. Why not try replaced locked with the enabled property. That way you have a visual indication of whether works or not.

Subsequently i have found out the following. it is the If IsNull that does not work , However if i write If Me!Brancho = 0 then it works.
Whys is it so ?

If Me!branch0 = 0 Then
'If IsNull(Me!branch0) Then
Me!cartons.Enabled = False
End If
 

Users who are viewing this thread

Back
Top Bottom