Conditional Formatting in Access 97

C

ctombolesi

I am trying to set a conditional formatting event where if
an item's score is less than 50 to change the background
to red, if greater/equal to 50 to change the background to
green.

I setup the following event procedure below:

Private Sub Form_Current()
If D_B_Score.Value < 50 Then
Me!D_B_Score.BackColor = RGB(255, 0, 0)
ElseIf D_B_Score.Value >= 50 Then
Me!D_B_core.BackColor = RGB(0, 255, 0)
Else
D_B_Score.BackColor = RGB(255, 255, 0)
End If
End Sub

The script seems to work, except that it turns all the
records who have d_B score to the color red if I enter a
49 in one record regardless of what the score is in the
remaining records.

Any suggestions on how I should change my script above?
 
A

Allen Browne

Access 97 cannot do this in a continuous form or datasheet.

The nearest you have to a built-in alternative in A97 is to use a coloured
flag alongside the actual field. Create another text box with Control souce
of:
[D_B_Score] < 50
and include the colors in the Format property.
 
T

Terry Hornsby

Isn't it possible to overlay the field onto textbox & set the field's
transparency so that textbox can be seen through it? This way the field
gives the illusion of
changing colour?

Terry Hornsby

Allen Browne said:
Access 97 cannot do this in a continuous form or datasheet.

The nearest you have to a built-in alternative in A97 is to use a coloured
flag alongside the actual field. Create another text box with Control souce
of:
[D_B_Score] < 50
and include the colors in the Format property.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

ctombolesi said:
I am trying to set a conditional formatting event where if
an item's score is less than 50 to change the background
to red, if greater/equal to 50 to change the background to
green.

I setup the following event procedure below:

Private Sub Form_Current()
If D_B_Score.Value < 50 Then
Me!D_B_Score.BackColor = RGB(255, 0, 0)
ElseIf D_B_Score.Value >= 50 Then
Me!D_B_core.BackColor = RGB(0, 255, 0)
Else
D_B_Score.BackColor = RGB(255, 255, 0)
End If
End Sub

The script seems to work, except that it turns all the
records who have d_B score to the color red if I enter a
49 in one record regardless of what the score is in the
remaining records.

Any suggestions on how I should change my script above?
 

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