View Full Version : Expression has no value


keving99
11-08-2007, 06:51 AM
I have a field on a report i want to change the forecolor if its value is 0, the field is a number field.
I have the follwoing code in the on open section

If Nz(Me!Txt1, 0) = 0 Then
Txt1.ForeColor = RGB(0, 255, 0)
End If

When i open the report i get
Run-time error'-2147352567 (80020009)
You entered an expression that has no value

There are records for the report and i have some on no data code.

RuralGuy
11-08-2007, 07:38 AM
Have you tried just using Conditional Formatting?

keving99
11-08-2007, 07:49 AM
Have you tried just using Conditional Formatting?

RuralGuy, yes i did that first, but the report is exported to HTML and it gets lost on conversion.

Thanks

RuralGuy
11-08-2007, 07:55 AM
Use the DetailPrint event rather than the Open event of the report.

Edit: That would be the Print event of the Detail section of the report.

keving99
11-08-2007, 08:42 AM
Thanks RuralGuy, fantastic, it works and it keeps its formating when converted to HTML.
Nice one :D

KevinG

RuralGuy
11-08-2007, 08:46 AM
Glad I could help.