I have a access 2007 report for which one of the fields returns a numerical value of $0 if there no dollar amount associated with the project listed, else it returns a dollar amount greater than $0.
What I want to do is build the report so that if the field value = $0, I want it to read “TBD” (without the quotes) else, I want it to return the dollar amount.
Two part question–first, what Sub class would I write the code under?
And, how would I go about writing the if else statement?
Here is what I came up so far and it doesn’t do anything (no errors, just returns the report with the $0’s printed where no dollar amount is available).
Private Sub Cost_AfterUpdate()
If ([YearofExpenditureCost] >= 0) Then
Me.Cost = "TBD"
Else: Me.Cost = [YearofExpenditureCost]
End If
Where the [Cost] is the name of the text box containing the ControlSource value of [YearofExpenditureCost].
Many thanks in advance for any advice you can offer.
You can use an immediate If as the Control Source of a textbox on the report. Ensure that the testbox has a name other than any of the fields in the recordsource: