Change the color of a line on a form via VB

  • Thread starter Thread starter Bill (Unique as my name)
  • Start date Start date
B

Bill (Unique as my name)

I can change the color of text in a box based on the value in another
field. Why not lines? How do I do it? Is it possible? The VB code
below does not work. I get no error messages. I get nothing. I want
something, oh, so badly.

If Combo48 = "144" Then
[Line62].BorderColor = 0
End If

Thanks in advance!
 
You can, but you have to assign an appropriate value to it! Zero is not an
appropriate value! If you replace the zero with, say vbRed, the line will
turn red!
I can change the color of text in a box based on the value in another
field. Why not lines? How do I do it? Is it possible? The VB code
below does not work. I get no error messages. I get nothing. I want
something, oh, so badly.

If Combo48 = "144" Then
[Line62].BorderColor = 0
End If

Thanks in advance!

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000

Message posted via AccessMonster.com
 
I can change the color of text in a box based on the value in another
field. Why not lines? How do I do it? Is it possible? The VB code
below does not work. I get no error messages. I get nothing. I want
something, oh, so badly.

If Combo48 = "144" Then
[Line62].BorderColor = 0
End If

Thanks in advance!

1) Where did you place the code?
Place it in the form's Current event AND in the combo AfterUpdate
event.

2) Is the Bound Column of the combo box a Number datatype or text?
If it is Number datatype then do not surround the value with quotes:
If Combo48 = 144 Then

3) If your code changes the color for a criteria value, you must then
change it back when the criteria is not met:

If Combo48 = "144" Then
[Line62].BorderColor = 0
Else
[Line62].BorderColor = vbBlue
End If
 
You can, but you have to assign an appropriate value to it! Zero is not an
appropriate value! If you replace the zero with, say vbRed, the line will
turn red!
I can change the color of text in a box based on the value in another
field. Why not lines? How do I do it? Is it possible? The VB code
below does not work. I get no error messages. I get nothing. I want
something, oh, so badly.

If Combo48 = "144" Then
[Line62].BorderColor = 0
End If

Thanks in advance!

Actually 0 is an appropriate value.
0 = Black (vbBlack)

The posters problem is either in his using "144" as a criteria instead
of 144 (without quotes) or in not turning the original line color back
on when the criteria is not met, or in not placing his code in the
Combo AfterUpdate AND in the Form Current event (he gives no
indication of where the code was placed).
 
Back
Top