continuous form dosn't change

  • Thread starter Thread starter Jean-Paul De Winter
  • Start date Start date
J

Jean-Paul De Winter

Hi,
I created a continuous form.
In the current event I wrote:
Private Sub Form_Current()
If Me!ASV_Werkhouding < 5 Then
Me.ASV_Werkhouding.ForeColor = 255
Else
Me.ASV_Werkhouding.ForeColor = 0
End If
If Me!ASV_Toetsen < 5 Then
Me.ASV_Toetsen.ForeColor = 255
Else
Me.ASV_Toetsen.ForeColor = 0
End If
End Sub

When the first record has values lower then 5 the value is written in red,
which is correct but all other values, even higher then 5 are printed in red
too.
This is only an example, the condition is much more complicated so
conditional formatting isn't an option here.

This can not be correct.
How to solve this

Thanks
JP
 
There is only one copy of the text box..and if you set the color..all
instances of the box will change.

When you go:
Me.ASV_Werkhouding.ForeColor = 255

Which instance of text box on the screen are you referring to? You can
change the above property in design mode, and when you switch back, you will
notice that the box has the above fore color. In a continues form..there is
only one instance of the box...so the above will apply to all of them. You
have no means of a particular instance of the text box...since in fact there
is only one instance...

So, the solution is to use conditional formatting.
This is only an example, the condition is much more complicated so
conditional formatting isn't an option here.

Why is condition formatting not a option? Why not make a function, and have
that function return true, or false.

You then simply put that function expression in the conditional formatting
expression, and your function code is called. I don't see why there is any
limitation in terms of complexity here? That function can have as many lines
of code and conditions as you want. And, you don't necessary have to have
the function return true, or false..you could have it return a number, like
1 or 2 or 3..and then setup 3 conditions formats for the color you want. You
are limited to 4 conditional formats for formatting..but by using a
function...at least there is no limits on the conditions...
 
this is a bit difficult I think...
But, shouldn't I write:
Me!ASV_Werkhouding.ForeColor = 255 instead of
Me.ASV_Werkhouding.ForeColor = 255

Thanks for the reply
JP
 
Back
Top