Good Morning Everyone,
I am a beginners level at best and I am trying to make a loop where the font colors on a form will be certain colors when loading based on a condition of whether the field 'ContrName(X)' is empty or has text. Most of my fields are categorized by the same name with a different number to distinguish between them. I have evolved into a complicated mess and it still states it can't find the fields even though when you do a watch of the variables it states the field name perfectly. I know most of this in the programming is probably unnecessary but I was trying to help the computer find these fields which it will not find even when I put the horse in the water. This computer is more stubborn than me and that is saying something.....does anyone see why it cannot find these fields?
Thanks for this site and any help somebody could offer,
Dave
Private Sub Form_Load()
Dim X As Integer
Dim S As String
Dim T As String
Dim U As String
Dim V As String
For X = 1 To 10
S = "ContrName" & CStr(X)
T = "Qty" & CStr(X)
U = "UnitCost" & CStr(X)
V = "calLabor" & CStr(X)
If IsNull(S) Then
Me![T].ForeColor = RGB(230, 237, 215)
Me![U].ForeColor = RGB(230, 237, 215)
Me![V].ForeColor = RGB(230, 237, 215)
Else
Me![T].ForeColor = RGB(186, 20, 25)
Me![U].ForeColor = RGB(186, 20, 25)
Me![V].ForeColor = RGB(186, 20, 25)
End If
Next X
End Sub