Subform Controls (please disregard previous post)

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
 
H

Hugh O'Neill

Andrew said:
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


You don't appear to have 'Set' your object isBlue to anything. You
need to define this. Have a look at Set in Help.

When you have finished with the object isBlue, remember to set it to
Nothing, so as to release the resource. e.g. Set isBlue = Nothing

hth

Hugh
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top