NULL VALUES IN REPORT

S

Songoku

Hi

I have a report in Access 97 where I am having to code the conditional
formating for specific values. This works great as long as there are values.
However when there are no values I get a an error saying

run-time error '2427' entered an expression that has no value

ok, so I guess this is null value related. I have tried nz in the query
which feeds the report but this does not work.

I am using if statements to perform the necessary conditional formating can
I use an if isnull ignore code?

If Me.stat1 = "Speeding" Or Me.stat1 = "Dangerous Driving" Or Me.stat1 =
"Abuse" Then
Me.stat1.ForeColor = vbRed
Else
Me.stat1.ForeColor = vbBlack
End If

any suggestions please Thnxs in advance
 
A

Allen Browne

Nothing in the code you posted looks like it should error with null.

Does this occur only when the report doesn't have records? That can generat
this error. If that's the cause, the solution would be to test the HasData
property of the report, i.e.:
If Me.HasData Then
If Me.stat1 = "...

Otherwise something else is going on.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top