Hi
What I'm trying to do is try to calculate the age of each person in a grid based on a date that's being stored in a form level variable. So
Dim DateToCalculate As Date
But I can't find a good way to use the value of this variable in the WinCalcManager. I can stuff the value of this variable in an unbound column, in each row, but that just seems dirty.
Any help would be appreciated.
Thanks
Ok, that was very helpful. Thanks!
That looks right to me.
The only thing is.. if the date changes, you will have to update the formula. So I would probably put this code into a method where you pass in the DateToCalculate and then you call this method any time the DateToCalculate value changes.
That's what I thought but I wasn't sure. So just to confirm,
MyCalcManager.NamedReferences("DateToCalculate").Formula = "Date(" & Year(DateToCalculate) & ", " & Month(DateToCalculate) & ", " & Day(DateToCalculate) & ")"
Hi,
This is what the NamedReferences collection on the UltraCalcManager is designed for.
Just add a NamedReference and give it a name, like "DateToCalculate". Then you can use "[DateToCalculate]" in any Formulas in your application. The formula for the DateToCalculate NamedReferece would probably use the Date function with a string so it returns the appropriate date.