Hi All,
I'm looking to disable/lock all controls, except search text box, including subform control. Currently, I'm using the code below and added the 'TypeOf ctrl is Subform', but am still able to enter data into the subform. I have users who occasionally enter data in the wrong field when the form opens and I need to disable as much as I can and force them to enter the needed info into the search field "NavJobSelect".
Will someone please tell me how to include the subform with all controls?
Any help is greatly appreciated.
Thanks in advance,
Pam
I'm looking to disable/lock all controls, except search text box, including subform control. Currently, I'm using the code below and added the 'TypeOf ctrl is Subform', but am still able to enter data into the subform. I have users who occasionally enter data in the wrong field when the form opens and I need to disable as much as I can and force them to enter the needed info into the search field "NavJobSelect".
Code:
Dim Ctrl As Control
If Me.NewRecord Then
For Each Ctrl In Me.Controls
If (TypeOf Ctrl Is TextBox) Or (TypeOf Ctrl Is CheckBox) Or (TypeOf Ctrl Is ComboBox) Or (TypeOf Ctrl Is SubForm) Then
If Ctrl.Tag <> "DoNotLock" Then
Ctrl.Enabled = False
Ctrl.Locked = True
DoCmd.GoToControl ("NAVJobSelect")
Else
Ctrl.Enabled = True
Ctrl.Locked = False
End If
End If
Next
Else
For Each Ctrl In Me.Controls
If (TypeOf Ctrl Is TextBox) Or (TypeOf Ctrl Is CheckBox) Or (TypeOf Ctrl Is ComboBox) Or (TypeOf Ctrl Is SubForm) Then
Ctrl.Enabled = True
Ctrl.Locked = False
End If
Next
End If
End Sub
Will someone please tell me how to include the subform with all controls?
Any help is greatly appreciated.
Thanks in advance,
Pam