View Full Version : Coloured fields for various values


saintsman
10-12-2001, 04:55 AM
I am trying to get a certain colour displayed for different value ranges (a traffic lights system). Although I can get 3 colours displayed using basic code (and I am not an expert in this) I am unable to get it to work when using BETWEEN.
For example if I write the following I get a compile error which displays "expected then or goto":

If fieldname.value between 1 and 10 then
fieldname backcolor = 255
(255=the number for red)

Where am I going wrong?
Thanks in advance

Rich
10-12-2001, 05:15 AM
Try If fieldname >0 and <=10 Then

saintsman
10-14-2001, 11:35 PM
Rich,
Thanks for the suggestion but it still does not work, although I can't fault your logic. When I write what you say I get a compile error looking for an expected expression before the <= symbols. I'm sure that I am doing something wrong. The code is written in an event procedure but I still can't figure out why something that should be so simple doesn't work.

Rich
10-15-2001, 01:22 AM
Try And Not >10

saintsman
10-15-2001, 04:33 AM
Still no joy. It doesn't seem to like two expressions in the same "If" statement.

Rich
10-15-2001, 04:53 AM
If Me.TextName > 0 And Me.TextName < 11 Then

saintsman
10-15-2001, 05:49 AM
Rich,

At last!

Yes that finally worked. Thanks for all your assistance, It's much appreciated.

Saintsman