Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2011

    Unanswered: Creating a query with a self-dependent field


    I am developing an Access database to handle an Excel-built algorithm. That is, the calculations to be executed by queries are built in Excel. I have now ecountered the problem of a calculation where the field I want to construct using a query depends on itself in other records.

    I have attatched the Excel file containing parts of the algorithm, and the problem arises in two variants, namely the calculations in rows 36 and 40.

    I truly hope that someone can help with a workaround for this problem.

    Thanks in advance!
    Attached Files Attached Files

  2. #2
    Join Date
    Dec 2004
    Madison, WI
    Try creating a function (in a module) and use that function as an expression in the query.


    Function retSomeValue(valPassedToFunction as variant) as variant
    ....some calc on valPassedToFunction here...
    retSomeValue = valPassedToFunction * 3
    End Function

    Then in your query, you can use that function against a field in an expression.
    MyExpression: retSomeValue([FieldXYZ])
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

Posting Permissions

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