When the Report loads it can calculate the value you need.
In the property of the Report you can put this into the OnLoad event.
Copy/paste in the code below that is between the -------- and complete...( I
only demo months 1-3 here but it just repeats).
Also, of course replace your actual field names in the generic field names I
supply that are found between the [ ] ...
Note; since you say that the Qtrly cost is * 3 if January...then I am
presuming somewhere is to be found the single month cost field to use in the
multiplication. I arbitrarily named this field [MonthCostField]. Obviously
this must exist for the math to be done....
Harder Core VBers pride themselves on more efficient code - but I like it
simple even if it is longer...easier to read...just a stack of If/thens...
Private Sub Report_Load()
----------------------------------------------------
If DatePart("m", [ActivationDateField]) = 1 Then
[QuarterCostField] = ([MonthCostField] * 3)
End If
If DatePart("m", [ActivationDateField]) = 2 Then
[QuarterCostField] = ([MonthCostField] * 2)
End If
If DatePart("m", [ActivationDateField]) = 3 Then
[QuarterCostField] = ([MonthCostField] * 1)
End If
etc etc repeat for months 4-12...
----------------------------
End Sub
hope this helps
--
NTC
2395 said:
it is an actual date field