Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query not returning results of formula

Status
Not open for further replies.

GLENEE

Programmer
Feb 9, 2005
64
GB
In my query i have a field 'Amount': which returns the result of a formula i.e: Amount: Sum([Charge]*0.299). However this formula may change over time and therefore i have produced a Form where by the user can enter a new formula for the query to use. I've ammended the query to Amount: Forms!Form1!txtFormula. The problem is that when the query runs the actual formula is displayed rather than the result e.g. the string "Sum([Charge]*0.299)" is returned. How do i get the query to recognise it as a forula and not a string??
 
A Parameter should return a value, not a formula.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
OOps, hit submit too fast.
If only the factor may change:
Amount: Sum([Charge]*Forms!Form1!txtFormula)
with txtFormula=0.299

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
MP9
Just tried it with no success, produced the following message - "This expression is typed incorrectly, or is too complex to be evaluated .....etc
 
PHV
I thought about that and that works fine.However i'm informed that the whole formula could be subject to change and not just the factor.
 
So, you may consider to rewrite the whole SQL property of the QueryDef object before launching the query.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top