Hello,
I want to automate text box design changes based on several conditions. For example, under some circumstances, I want to make a text box locked and change its appearance, so it's obvious that it's locked.
I tried this:
Code:
Public Const COLOR_LOCKED As Long = 10855845 ' #A5A5A5
Public Sub MakeControlLocked(FormName As String, ControlName As String, Optional LabelName As String)
Forms!FormName!ControlName.ForeColor = COLOR_LOCKED
Forms!FormName!ControlName.Locked = True
End Sub
And then call it from any form like this:
Code:
Private Sub cmdTest_Click()
MakeControlLocked Me.Name, txtNotes
End Sub
However it seems like I cannot send form name as a parameter like this, because I get Runtime 2450: “Cannot Find The Referenced Form”
Is there any way to accomplish this? Thanks.