Link to home
Create AccountLog in
Microsoft Access

Microsoft Access

--

Questions

--

Followers

Top Experts

Avatar of Uptime Legal Systems
Uptime Legal Systems🇺🇸

Formula based off field - MS Access
Hi Experts!

I'm wondering if there is a way in which I could take a series of variables and allow users to construct custom forumlas off those to run calculations.

So for example, I may have 4 variables --  A, B, C, D.  Would there be a way I could do an 'expression builder' where I could -say- let users build a formula such as " A + B ^ 0.5 " and then use that formula elsewhere to display data?

Maybe a sub form that allows logic to be built and then on save VB updates the variable?

Zero AI Policy

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.


ASKER CERTIFIED SOLUTION
Avatar of Gustav BrockGustav Brock🇩🇰

Link to home
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.
Create Account

Avatar of Dale FyeDale Fye🇺🇸

No points, please.

As Gustav said, the Eval() function will do the job.

You could have your users enter the function in a text box, like:

A + B ^ .05

Then you could use the Replace() function to replace instances of each of the variables:

strEval = Replace(me.txt_Eval, "A", "Str(A)")
strEval = Replece(strEval, "B", "Str(B)")
...

Then you could store that value and use it Elsewhere in your code.

Avatar of Uptime Legal SystemsUptime Legal Systems🇺🇸

ASKER

Ah, great thanks to both!

Avatar of Gustav BrockGustav Brock🇩🇰

You are welcome!

/gustav

Reward 1Reward 2Reward 3Reward 4Reward 5Reward 6

EARN REWARDS FOR ASKING, ANSWERING, AND MORE.

Earn free swag for participating on the platform.

Microsoft Access

Microsoft Access

--

Questions

--

Followers

Top Experts

Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.