06-20-11, 07:27 #1Registered User
- 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!
06-20-11, 15:36 #2Moderator
- 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
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)