Calculated field on report problem

north-bc

New member
Local time
Today, 00:01
Joined
Jan 4, 2005
Messages
8
Hi there, just a question for you guru's out there. I have a report that has a field on it called total_poles. What I am trying to do is create a report that has this field on it, but also has a calculated field on it called Poles_fine. The problem that I am having is that the calculated field needs a nested if..then..else field in it and I am not sure how to write one like that. Here is what is supposed to happen..

if [total_poles] <= 3 then [Poles_fine] = 50
if [total_poles] > 3 and <=6 then [Poles_fine] = 100
if [total_poles] >= 7 and < 10 then [Poles_fine] = 150
if [total_poles] >= 10 then [Poles_fine] = 200

I hope that is clear enough for you.
Thanks,
Todd :)
 
If the Poles_Fine textbox appears in the detail section, go to the On Format event for the detail section and paste in something like.

Code:
Select Case Total_Poles
     Case Is < 4
          txtPolesFine = 50
     Case 4, 5 ,6
          txtPolesFine = 100
     Case 7, 8, 9 
          txtPolesFine = 150
     Case Is > 9
          txtPolesFine = 200
End Select

This is assuming Total_Poles is an integer. Give your textbox the name txtPolesFine. Because this is a calculated field, you don't want to bind it to your table.
 

Users who are viewing this thread

Back
Top Bottom