Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
120
Set a Date in a Named Reference
posted

Hello,

I am revisting a problem I had previously and still have no luck in resolving it. (I am using v9.2)

I am setting Named References from column data in a Wingrid. When a try to set a Date as a named reference, the calculations do not work - I notice that the formula result (when setting the Named Reference Formula) is returning as an error.

Here is an excerpt from my code. You will see that the debug line is always hit. The Message returned is Incorrect type of argument or operand.

    If uds.Rows(iRow).Item(iLoop) IsNot Nothing Then

        Dim dtDate As Date

        dtDate = CType(uds.Rows(iRow).Item(iLoop), Date)

     Calcmanager.NamedReferences.Item(sKey).Formula = " DATEVALUE( " & Chr(34) & dtDate.ToString("MM/dd/yyyy hh:mm tt") & Chr(34) & " )"

             If Calcmanager.NamedReferences.Item(sKey).FormulaResult.IsError Then

            Debug.WriteLine(CType(Calcmanager.NamedReferences.Item(sKey).FormulaResult.Value, Infragistics.Win.CalcEngine.UltraCalcErrorValue).Message)

        End If

    End If

I even tried simply hard coding a date like this line:

Calcmanager.NamedReferences.Item(sKey).Formula = " DATE(  1,1,2010)"

But still I get the same error.

Can you please help with setting this Named Reference.

Regards and Thanks.

Greg.

Parents Reply Children
No Data