J
jjones
I have a simple '97 database for tracking our equipment inventory, and one
component of that references the status of the equipment—“Deployedâ€, “On
Holdâ€, or “In Stockâ€. For doing a quick stock check, I have a continuous
form based on an underlying query. The form has a row for each type of
equipment and a column for each status where the records are counted (and I
have the back color of the text boxes color coded…i.e. Deployed=red, On
Hold=yellow, In Stock=green) So my row 1 looks something like “Widget xâ€,
then column 1 has a total of the # of widget x’s deployed, column 2 - # of
widget x’s on hold, column 3 - # of widget x’s in stock. The only
problem—and this is really more cosmetic than being an actual functional
problem—but if there’s not any equipment at all in any particular
status—let’s say none of my various widget types are on hold—then I see a
whole column full of #Name? errors. I’m trying to write an event procedure
with an if statement so that if the field contains this error then the
forecolor (font) is changed to match the backcolor of the text box so that I
won’t actually see the #Name? errors. In Excel this would be something like
if(iserror(…). I tried the following code and inserted it into events for
before update, after update (I guess that would work?).
Private Sub On_Hold_AfterUpdate()
If Me.[On Hold] = "#Name?" Then
Me.On Hold.ForeColor = 10092543
ElseIf Me![On Hold] <> "#Name?" Then
Me.On Hold.ForeColor = -2147483640
End If
End Sub
component of that references the status of the equipment—“Deployedâ€, “On
Holdâ€, or “In Stockâ€. For doing a quick stock check, I have a continuous
form based on an underlying query. The form has a row for each type of
equipment and a column for each status where the records are counted (and I
have the back color of the text boxes color coded…i.e. Deployed=red, On
Hold=yellow, In Stock=green) So my row 1 looks something like “Widget xâ€,
then column 1 has a total of the # of widget x’s deployed, column 2 - # of
widget x’s on hold, column 3 - # of widget x’s in stock. The only
problem—and this is really more cosmetic than being an actual functional
problem—but if there’s not any equipment at all in any particular
status—let’s say none of my various widget types are on hold—then I see a
whole column full of #Name? errors. I’m trying to write an event procedure
with an if statement so that if the field contains this error then the
forecolor (font) is changed to match the backcolor of the text box so that I
won’t actually see the #Name? errors. In Excel this would be something like
if(iserror(…). I tried the following code and inserted it into events for
before update, after update (I guess that would work?).
Private Sub On_Hold_AfterUpdate()
If Me.[On Hold] = "#Name?" Then
Me.On Hold.ForeColor = 10092543
ElseIf Me![On Hold] <> "#Name?" Then
Me.On Hold.ForeColor = -2147483640
End If
End Sub