>>>I am trying to get some specific calculations off of items sold in a POS system and print them on a report. Unfortunately, because these calculations vary greatly on several factors... it would be next to impossible to put them in the small EXPRESSION field in the report writer itself. In addition, trying to store them in temporary variables during the actual criteria step of the report call would be nearly impossible as well... to many factors control what needs to be calculated.
>>>
>>>I can write the actual calculations in a couple of code snippets and want to know if there is a way to call that coded routine from the actual report and have it return to the report the final calculation for printing.
>>>
>>>Thanks ahead of time.
>>
>>To expand Ed's solution. Put a textbox on the form with expression MyFunction(). Let your function to return empty string. Add remove if blank option to this textbox.
>
>
>Thanks everyone... this worked just fine. I created a function, pass it the amount to base the calculations off of, and it returns the correct fees which print on the report.
>
>One more related question... is there a way to SUM the returns from this function so we can put a total at the bottom of the report?
>
>Thanks again...
Looks like this has to be done through report variable. Then Don's warning may apply. In other words, you would need to have a report variable and the value to assign would be result of your function. You can check SUM in the calculations.
If it's not broken, fix it until it is.
My Blog