I have control source on a form [ProjectDescription] and the Form Name is also ProjectDescription.
Public FilterCtl As String has been previously declared.
On my Form I enter into a the control which triggers this:
Then I move to a text box and enter key words and press a control button:Code:Private Sub ProjectDescription_Enter() Me.ActiveControl.SetFocus FilterCtl = Screen.ActiveControl.Name End Sub
This all works fine.Code:Private Sub cmdFilterKey_Click() Me.Filter = FilterCtl & " Like " & Chr(34) & "*" & Me.TextKeyWords & "*" & Chr(34) Me.FilterOn = True Me.Requery End Sub
My question is the use of "Screen.ActiveControl.Name". This gets the form name of the control. It only works in Me.Filter if that name is the same as the actual control source itself. How do I get it to work if the name of the control source field name is different than the control name. For instance the form name of [ProjectDescription] is ProjDesc?
I can't figure out what to use in place of FilterCtl = Screen.ActiveControl.Name
Thanks in advance.