disable fields on checkbox true

lotarugg

Registered User.
Local time
Yesterday, 20:23
Joined
Mar 15, 2011
Messages
34
Hi, apologies for over using this great forum the last few days....

I want to disable or lock fields on a form should a checkbox be true. I am just trying this out on the next field after the checkbox so far and have -

If Not IsNull (Me.Check136) Then
Me.Passed_to.Enabled = False
Else
Me.Passed_to.Enabled = True
End If
I have used Locked as well as Enabled but the complier hates them both

Thanks

(Last thread for a while I hope!)
 
Checkboxes are usaully True or False unless they are TriState (and you wouln't want one of them).
 
You'll also need code in your OnCurrent event in order for the formatting to persist as you move from record to record.
Code:
Private Sub Check136_AfterUpdate()
 If Me.Check136 = -1 Then
  Me.Passed_to.Enabled = False
 Else
  Me.Passed_to.Enabled = True
 End If
End Sub
Code:
Private Sub Form_Current()
 
 If Me.Check136 = -1 Then
  Me.Passed_to.Enabled = False
 Else
  Me.Passed_to.Enabled = True
 End If
 
 End Sub
If the 'complier' doesn't like this you need to check your Control names to make sure they're spelled correctly.

Linq ;0)>
 

Users who are viewing this thread

Back
Top Bottom