Hi,
I am trying to use some code I found on this forum from Bob Larson, thread ID 207138, that loops through all of the controls on a form and looks for a message in the tag property and based on its contents either locks or unlocks the control.
When I write the code it does not allow .tag as an option (I am using 2013, but I found somebody else ask the question from 2010 as well). If I step through the code, it finds the Select statement and starts looping through the controls but does not go into the if statement inside the select statement.
I will actually run it through all ctrl types but for the purposes of debugging I'm just trying to do the text boxes. I can see in step mode that it jumps straight from "Case acTextBox" to the "End Select" line without even entering the if statement.
Does anyone know if a change occurred in 2010 that changed this syntax?
Thanks,
Natalie
I am trying to use some code I found on this forum from Bob Larson, thread ID 207138, that loops through all of the controls on a form and looks for a message in the tag property and based on its contents either locks or unlocks the control.
When I write the code it does not allow .tag as an option (I am using 2013, but I found somebody else ask the question from 2010 as well). If I step through the code, it finds the Select statement and starts looping through the controls but does not go into the if statement inside the select statement.
Code:
Function LockUnlock(frm As Form, blnLock As Boolean)
Dim ctl As Control
Dim prp As Property
For Each ctl In frm.Controls
Select Case ctl.ControlType
Case acTextBox
If ctl.Tag <> "DoNotLock" Then
ctl.Locked = blnLock
Else
ctl.Locked = False
End If
End Select
Next
End Function
I will actually run it through all ctrl types but for the purposes of debugging I'm just trying to do the text boxes. I can see in step mode that it jumps straight from "Case acTextBox" to the "End Select" line without even entering the if statement.
Does anyone know if a change occurred in 2010 that changed this syntax?
Thanks,
Natalie