Liking a checkbox to lock down a subform.

  • Thread starter Thread starter Migratorymoab
  • Start date Start date
M

Migratorymoab

Guest
I am currently setting up a db, and I am at a point where a record might need to be locked down if a certain checkbox is activated. Does anyone out there know how to accomplish this?
 
This should work for you:

Code:
Private Sub chkMyCheckBox_Click()
    If chkMyCheckBox = True Then
        frmFormName.Enabled = True
    Else
        frmFormName.Enabled = False
    End If
End Sub
 
I personally have a form where I did this by locking all of the controls, and call this from the Form_Current Event, this way when you go to that record, it will know whether to lock or not
Code:
Sub Locking
On Error goto Err_Locking

For Each ctlControl In frmYours.Controls
    ctlControl.Locked = chkLock
Next
'so you can still uncheck this
chkLock.Locked = False
Exit_Locking:
    Exit Sub
    
Err_Locking:
    'if control doesn't lock eg. lables etc.
    If Err = 438 Then
        Resume Next
    Else
        MsgBox Err.Description
        Resume Exit_Locking
    End If
 

Users who are viewing this thread

Back
Top Bottom