Conditional Formatting

Surjer

Registered User.
Local time
Today, 15:44
Joined
Sep 17, 2001
Messages
232
I have 2 tables

Final_MH
and
Dup Checks

Then I have 1 querySELECT Final_MH.*, [DUP CHECKS].*, [Final_MH]![Northing]-[DUP CHECKS]![NORTHING] AS Expr1, [Final_MH]![Easting]-[DUP CHECKS]![EASTING] AS Expr2, [Final_MH]![Elev]-[DUP CHECKS]![ELEV] AS Expr3, [DUP CHECKS].MH_ID
FROM Final_MH, [DUP CHECKS]
WHERE ((([DUP CHECKS].MH_ID)=[Final_MH]![MH_ID]));


Then I have a report that lines up the appropriate fields and shows the difference between the two records!

Is there a way to Color the results "RED" if they are over "0.02"?

Thanks in advance,
Jerry
 
I am pretty sure that the Properties of a text box are read only, so I don't think they can be set with code?
 
If Me.SomeField >.02 Then
Me.SomeField.ForeColour=255
Else
Me.SomeField.ForeColour=0
End If
 
Run-Time Error -438-
Object doesn't suport this property or method.

This is the error I get when it gets to:

Me.Expr1.forecolour = 255
The Report Record Source is "Dupe MH Checks"
The TextBox name is EXPR1
The TextBox control source is EXPR1

Hmmmmm..
 
You need to change the text box name to something different than that of the control name, something more meaningful perhaps.
 
Nice try Rich but here in the US where Access was born, we spell color without a u
smile.gif
 
Private Sub Report_Open(Cancel As Integer)
If Me.diffNorthing > 0.02 Then
Me.diffNorthing.ForeColor = 255
Else
Me.diffNorthing.ForeColor = 0
End If
End Sub

Reported an error:

You entered an expression that has no value!


[This message has been edited by Surjer (edited 10-24-2001).]
 
OK use the on format event of the detail section and include the fields that control the initial calculation ie
If Me.Field1-Me.Field2 <.02 Then
Me.Field3.ForeColor=255
Else
Me.Field3.ForeColor = 0
End If
End Sub
It's difficult you know trying to spell in a foreign language, Access appeared to be written in Double Dutch when I first started
smile.gif
 
We are getting closer:

However,
After the condition is set to be true then every record after that is Tagged "RED"
If I keep the Else: part in It doesn't capture the <-.2..

I guess this is because I am setting its property on the event that the data becomes true...
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)


If Me.Final_MH_NORTHING - Me.DUP_CHECKS_NORTHING > 0.2 Then
Me.diffNorthing.ForeColor = 255
End If
If Me.Final_MH_NORTHING - Me.DUP_CHECKS_NORTHING < -0.2 Then
Me.diffNorthing.ForeColor = 255
End If

'''''''''''''''''''''''''

If Me.Final_MH_EASTING - Me.DUP_CHECKS_EASTING > 0.2 Then
Me.DiffEasting.ForeColor = 255
End If
If Me.Final_MH_EASTING - Me.DUP_CHECKS_EASTING < -0.2 Then
Me.DiffEasting.ForeColor = 255

End If

'''''''''''''''''''''''''

If Me.Final_MH_ELEV - Me.DUP_CHECKS_ELEV > 0.2 Then
Me.diffElev.ForeColor = 255
End If
If Me.Final_MH_ELEV - Me.DUP_CHECKS_ELEV < -0.2 Then
Me.diffElev.ForeColor = 255
End If


End Sub


Thanks for you're help peoples,
Its getting real close!


I there a way to use a Between? Maybe?

Thanks Again...
This Forum is Great!!!!

[This message has been edited by Surjer (edited 10-25-2001).]
 
I don't have time to try this
If Me.Final_MH_NORTHING - Me.DUP_CHECKS_NORTHING > 0.2 OR <-.2 Then
Me.diffNorthing.ForeColor = 255
Else

more luck if it works.
 
This worked,


Thanks A mill######Option Compare Database
Option Explicit


Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me.Final_MH_NORTHING - Me.DUP_CHECKS_NORTHING > 0.2 < -0.2 Then
Me.diffNorthing.ForeColor = 255
Else
Me.diffNorthing.ForeColor = 0
End If

'''''''''''''''''''''''''

If Me.Final_MH_EASTING - Me.DUP_CHECKS_EASTING > 0.2 < -0.2 Then
Me.DiffEasting.ForeColor = 255
Else
Me.DiffEasting.ForeColor = 0
End If


'''''''''''''''''''''''''

If Me.Final_MH_ELEV - Me.DUP_CHECKS_ELEV > 0.2 < -0.2 Then
Me.diffElev.ForeColor = 255
Else
Me.diffElev.ForeColor = 0
End If
End Sub
 

Users who are viewing this thread

Back
Top Bottom