That's disturbing. The quotes are wrong for a number, so somewhere along
the
line the data type is the problem.
Try asking Access how it understands the data type.
Temporarlily add a text box to the same section of the report, setting
its
Control Source property to:
=TypeName([ThresholdScore].[Value])
Trace the field back. If the report is based on Query1, open the
Immediate
Window (Ctrl+G), and enter:
? CurrentDb.QueryDefs("Query1").Fields("ThresholdScore").Type
A number between 2 and 7 indicates numeric.
10 is Text.
9 means JET can't tell.
Other values are in the DAO (decimal) column here:
http://allenbrowne.com/ser-49.html
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Reply to group, rather than allenbrowne at mvps dot org.
message
The data type of the thresholdscore is a number. What I want to do is
have
the backcolor of the threshold control change depending on the value in
it.
The code is in the format event of the detail section of the report.
I removed the "" and still got the same error "Type Mismatch"
I don't see anything else that would be messing up the backcolor. There
isn't any conditional formatting being used for this control.
:
Suggestions:
1. What data type is ThresholdScore?
If Number, drop the quotes around the values, .e.g:
Case 150
If you are not sure, Access Access:
Debug.Print TypeName(Me!ThresholdScore.Value)
2. Format event of what?
It needs to be the Format event of the section that contains the
ThreshholdScore control.
3. Is there anything else that could be messing up the BackColor?
For example, is the control using Conditional Formatting?
message
I'm trying to change the backcolor of my text control on my report.
I
have
this code in the format event but it doesn't seem to be working.
Select Case Me!ThresholdScore
Case "150"
Me!ThresholdScore.BackColor = 10092543
Case "140"
Me!ThresholdScore.BackColor = 12632256
Case "130"
Me!ThresholdScore.BackColor = 5540756
Case "120"
Me!ThresholdScore.BackColor = 65535
Case "110"
Me!ThresholdScore.BackColor = 255
Case Else
Me!ThresholdScore.BackColor = 255
End Select