I'm trying to lock a form. I have this programmed into it:
Private Sub Form_Current()
Dim Ctl As Control
For Each Ctl In Me
If Ctl.ControlType = acTextBox Or Ctl.ControlType = acComboBox Then
Ctl.Locked = True
Ctl.BackColor = RGB(200, 200, 200)
End If
Next
End Sub
It works great to lock the form as soon as it is opened. I have a yes/no field (FormLocked) that I want to control if it locks or not. How I'm sure that it will require an if statement. I'm having a problem writing the if statement to say that if I have FormLocked as true, I want the code to run, but if it FormLocked is False, I want the form not locked.