Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Aug 2002
    Leuven, Vlaanderen, Belgium
    Thanked 0 Times in 0 Posts

    Intermediate values slow down query & function? (97)

    Dear members of this board, I didn't know how to formulate this one...

    I have a function (Function1) used in another function (Function2) (actually more than one, but to keep it simple...).
    I need the results of both functions to be shown in a query (& form,...).

    My current setup is:

    Public Function Function1(var1, ..., varN)
    End Function

    Public Function Function2(var1,...,varN,...,varM)
    Function2 = ... Function1(var1,...,varN)
    End Function

    Now I wonder if I could speed up the query & function by rewriting the second function into:

    Public Function Function2(ResultFunction1,...,varM)
    End Function

    In the query design, this would mean a change in the fields used:
    from: ... + Function1(var1,..., varN) + Function2(var1,...,varN,...,varM)
    to: ... + Function1(var1,..., varN) + Function 2(Function1,varN+1,...,varM)

    I suppose this could be faster because those first N fields then would be used only once (for Function1): Function2 would use just a value (the result of Function1) in it's calculations instead of calling Function1 (again) in code. Further, it would simplify my code a bit (with less arguments for function2). (With one limitation: this implies that I can use Function2 nowhere in a query without also including Function1.)

    Does anyone know from experience if this trick could work?
    (If not, I can save some risk & valuable time by not trying it out <img src=/S/bow.gif border=0 alt=bow width=15 height=15> )

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 28 Times in 28 Posts

    Re: Intermediate values slow down query & function? (97)

    Calling Function2 as Function 2(Function1,varN+1,...,varM) won't work, it would have to be Function 2(Function1(var1, ..., varN),varN+1,...,varM). So I don't think you'll gain much, if anything.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts