I have written some code to alter the format of a text box when a specific date range is found in the Dlookup. Please bear with me I am relatively inexperienced in VBA!
Private Sub Command590_Click()
W = Now()
Dim X As Date
Dim Y As Integer
X = DLookup("[ISSUE DATE] ", "[MasterWiList_Qry]", "[DESCRIPTION] ='" & [Lvl1Skills_Tbl.1S1] & "'")
Y = Now() - X
Me.Text591.Value = Y
If Me.Text591.Value < 50 Then
Me.Lvl1Skills_Tbl_1S1.ForeColor = 255
Else
Me.Lvl1Skills_Tbl_1S1.ForeColor = 0
End If
End Sub
The code above relates to just one text box, I have approx 30 I need to update in this manner.
I don't want to code every box separately so my question is how do I adjust the code above to loop or cycle through the lookups & Text box references?
Any help will be greatly appreciated
Private Sub Command590_Click()
W = Now()
Dim X As Date
Dim Y As Integer
X = DLookup("[ISSUE DATE] ", "[MasterWiList_Qry]", "[DESCRIPTION] ='" & [Lvl1Skills_Tbl.1S1] & "'")
Y = Now() - X
Me.Text591.Value = Y
If Me.Text591.Value < 50 Then
Me.Lvl1Skills_Tbl_1S1.ForeColor = 255
Else
Me.Lvl1Skills_Tbl_1S1.ForeColor = 0
End If
End Sub
The code above relates to just one text box, I have approx 30 I need to update in this manner.
I don't want to code every box separately so my question is how do I adjust the code above to loop or cycle through the lookups & Text box references?
Any help will be greatly appreciated