I'm trying to return a number from the following function. The number is defined as double, and I tried declaring all my variables as double prior to variant. If i substitute focusnumber with a specific example of a number I'm trying to search (5.002 for example) I receive the desired result. Otherwise varx always =0. Please help.
Code:
Function roottransaction(FormulaItemNumber As Variant, FocusNumber As Variant) As Integer Dim varx As Variant, vary As Variant, x As Integer varx = FormulaItemNumber x = 0 Do vary = DLookup("[Previousid]", "FormulaItemsDescriptionView", "[FormulaItemNumber] =" & varx) If vary = 0 Then varx = 0 x = 1 ElseIf (vary = FocusNumber) Then varx = 1 x = 1 Else varx = vary End If Loop Until x = 1 roottransaction = varx End Function
Comment