• Intermediate values slow down query & function? (97)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Intermediate values slow down query & function? (97)

    Author
    Topic
    #405009

    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 bow )

    Viewing 1 reply thread
    Author
    Replies
    • #828275

      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.

    • #828276

      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.

    Viewing 1 reply thread
    Reply To: Intermediate values slow down query & function? (97)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: