Help with summing a control.


Eric Brenner

In one of my reports, I have a textbox control that, when viewed, will
display the cost of a transaction. This control calls a function that
grabs the correct cost info. See below:

The name if the text box is txtProductDescription.

The control source on the textbox control is =CostInfo([TransactionID],

Function CostInfo(TransactionID As Integer, HistoryID As Integer)
Select Case TransactionID
Case 2 'Repair
CostInfo = DLookup("[RepairCost]", "tblRepair",
"[HistoryID] = " & HistoryID)
If IsNull(CostInfo) Then CostInfo = 0#
lngRepairCost = lngRepairCost + CostInfo
Case 3 'Change Location
CostInfo = DLookup("[PriceCharged]", "tblChangeLocation",
"[HistoryID] = " & HistoryID)
If IsNull(CostInfo) Then CostInfo = 0#
lngLocationCost = lngLocationCost + CostInfo
Case 5 'Calibration
CostInfo = DLookup("[CalibrationCost]", "tblCalibration",
"[HistoryID] = " & HistoryID)
If IsNull(CostInfo) Then CostInfo = 0#
lngCalibrationCost = lngCalibrationCost + CostInfo
End Select
End Function

I want to sum this control. How do I do this?

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