D
Dominic Smith via AccessMonster.com
As a way of future-proofing an Access Database, I have built a table where
the user can enter calculations as text e.g.
Tax Rate * Discount Rate /(Capital Spend - 1) + (Warranty - 5)
Each item will have a corresponding amount somewhere in the database. The
base calculations will always be the same but the numbers will vary
depending on the criteria a user chooses.
I've got code that will build the calculation and produce the following
string -
9 * 10 / ( 88 - 1 ) + ( 27 - 5 )
(there are no spaces by the way, I've put them in to make it clearer)
What I can't do is make VB perform the actual calculation to return the sum
- I've tried converting it at various points but I still get an type
conversion error and/or just the string.
Assigning a variable to the calculation in the debug window works but I
can't seem to convert the calculation string into an actual sum within the
code.
Is there a straightforward way of simply converting a string to a
calculation in the same was as Cdbl or Cstr works?
Or does anyone have any clues as to the best way of doing this.
Thanks in advance
Dom
the user can enter calculations as text e.g.
Tax Rate * Discount Rate /(Capital Spend - 1) + (Warranty - 5)
Each item will have a corresponding amount somewhere in the database. The
base calculations will always be the same but the numbers will vary
depending on the criteria a user chooses.
I've got code that will build the calculation and produce the following
string -
9 * 10 / ( 88 - 1 ) + ( 27 - 5 )
(there are no spaces by the way, I've put them in to make it clearer)
What I can't do is make VB perform the actual calculation to return the sum
- I've tried converting it at various points but I still get an type
conversion error and/or just the string.
Assigning a variable to the calculation in the debug window works but I
can't seem to convert the calculation string into an actual sum within the
code.
Is there a straightforward way of simply converting a string to a
calculation in the same was as Cdbl or Cstr works?
Or does anyone have any clues as to the best way of doing this.
Thanks in advance
Dom