Hi everyone,
Using : Access 2007
I have built a floor plan for my company. These's about 200 different desk locations on a form. Each of them are named from desk701001 to desk801223. Anyways, that doesnt matter.
What I would like to do is to build a search button that looks at all those textboxes on that form, find to one that = to "txtsearch" (which is going to be whatever the user inputs in a textbox) and change the color of the font to red for that it is easy to find.
I know how to do it manually by checking each and everyone at a time, but that would be too long. There should be a way to do this a little easier. I've been checking around and cant seem to find exactly what I'm looking for.
I tried this (dont laugh):
But it keeps giving me the error:
Run time error 438
Object doesnt support this property or method
Help please!
Thanks in advance.
Luc
Using : Access 2007
I have built a floor plan for my company. These's about 200 different desk locations on a form. Each of them are named from desk701001 to desk801223. Anyways, that doesnt matter.
What I would like to do is to build a search button that looks at all those textboxes on that form, find to one that = to "txtsearch" (which is going to be whatever the user inputs in a textbox) and change the color of the font to red for that it is easy to find.
I know how to do it manually by checking each and everyone at a time, but that would be too long. There should be a way to do this a little easier. I've been checking around and cant seem to find exactly what I'm looking for.
I tried this (dont laugh):
Code:
Dim ctl As Control
For Each ctl In Me.Controls
If ctl.Control = Me.txtsearch Then
ctl.ForeColor = vbRed
Else
ctl.ForeColor = vblack
ctl.SetFocus
Exit For
End If
Next ctl
But it keeps giving me the error:
Run time error 438
Object doesnt support this property or method
Help please!
Thanks in advance.
Luc