A
Andrew
I have a subform with a variable amount of textboxes.
Each textbox should have its own color, depending on the
value of the field L3_Status. When I try to run the form,
I get the following error message:
"Run-time error '91':
Object variable or With block variable not set"
I have no idea what is wrong. Here is the main excerpt
from my code:
Dim lngRed As Long
Dim lngBlue As Long, lngYellow As Long, lngGreen As
Long
Dim lngGray As Long, lngWhite As Long, lngBlack As Long
Dim isBlue As FormatCondition
'**********************************************************
***
'Set the Status Colors for Level 3 Forecast Finish dates
lngRed = RGB(255, 0, 0)
lngBlue = RGB(37, 145, 241)
lngYellow = RGB(255, 255, 0)
lngGreen = RGB(0, 155, 0)
lngGray = RGB(100, 100, 100)
lngWhite = RGB(255, 255, 255)
lngBlack = RGB(0, 0, 0)
With isBlue
.ForeColor = lngWhite
.BackColor = lngBlue
.FontBold = True
End With
L3_Status.FormatConditions.Add acFieldValue,
acEqual, "B" = isBlue
Each textbox should have its own color, depending on the
value of the field L3_Status. When I try to run the form,
I get the following error message:
"Run-time error '91':
Object variable or With block variable not set"
I have no idea what is wrong. Here is the main excerpt
from my code:
Dim lngRed As Long
Dim lngBlue As Long, lngYellow As Long, lngGreen As
Long
Dim lngGray As Long, lngWhite As Long, lngBlack As Long
Dim isBlue As FormatCondition
'**********************************************************
***
'Set the Status Colors for Level 3 Forecast Finish dates
lngRed = RGB(255, 0, 0)
lngBlue = RGB(37, 145, 241)
lngYellow = RGB(255, 255, 0)
lngGreen = RGB(0, 155, 0)
lngGray = RGB(100, 100, 100)
lngWhite = RGB(255, 255, 255)
lngBlack = RGB(0, 0, 0)
With isBlue
.ForeColor = lngWhite
.BackColor = lngBlue
.FontBold = True
End With
L3_Status.FormatConditions.Add acFieldValue,
acEqual, "B" = isBlue