Hi Ryan.
After I worked on it for a while, I saw why this one gave you problems. But here's a solution.
In the Tag Property of your labels that correspond with Text Boxes, put the name of the Text box. For example, set the Tag property of lblOne to txtOne, and set the Tag property of lblTwo to txtTwo, and so on.
Then, replace your code with this code:
.Code:Dim x As Object For Each x In Me.Controls If Left(x.name, 3) = "txt" Then If x.name <> "txtdate_terminated" Or x.name <> "txtemp_mi" Or x.name <> "txtnotes" Then If x.Text = "" Then Dim y As Object For Each y In Me.Controls If y.Tag = x.name Then y.ForeColor = &HFF& Exit For End If Next y End If End If End If Next x
There may have been an easier way to do this, but it's Friday and I'm going home!
All the best.
Chris





Reply With Quote