Executing text from a database

  • Thread starter Joseph M. Newcomer
  • Start date
J

Joseph M. Newcomer

OK, here's a problem someone ran by me:

The context is a database program that is going out to hundreds of people. A particular
numeric computation involves a formula, let's just say that it is of the form
aX + bY + cZ

where a, b, and c are coefficiences and X, Y and Z are fields. The problem is that the
customer decides for this value what the coefficients are and what the fields are. And
the formula is probably not as simple as I wrote; the customer may want to write
1.10*(aX + bY) - dT + cZ / 3.141592
So the question goes something like this:

If we have a table which is the "Customization" table, and has just one row, and the row
has fields like "Name", "Address", "Primary Contact" and things like this (that will print
on every page that goes out from the organization issuing the piece of paper), is it
possible to add a field called "TheFormula" in which the customer can write, with careful
instruction, a VBA expression, and have the form say
Total: [Execute(Customization.TheFormula)]
(I don't write VBA for a living, I sort of can recognize it when it goes by, but this
question is FAR too deep for my experience). If the idea I've skecthed out won't work,
alternatives that would allow a customer-supplied formula to be provided would be welcome.

Key here is that they can't be maintaining "custom formulae" in the VBA source or in the
forms themselves for potentially several thousand customers.

(It turns out that many customers can probably use a "default formula" that would be
supplied, or possible executed if TheFormula is an empty string; but the exceptions will
be numerous and idiosyncratic, is my understanding of the problelm domain)
thanks
joe
Joseph M. Newcomer [MVP]
email: (e-mail address removed)
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top