473,385 Members | 1,351 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

This is different: Converting a formula to a value

Don't ask why, this is just something a client wants to do...

I want to put a form in my database with 4 text boxes; txtA, txtB,
txtFormula and txtValue

The client wants to be able to enter numbers into txtA and txtB. He
then wants to be able to enter a formula in txtFormula and spit the
value into txtValue.

So, for instance, he enters 6 into txtA and 10 into txtB. In
txtFormula he types; (txtA + txtB) / 2

txtValue should then display the number 8.

Is this possible?

Jun 4 '07 #1
10 1500
ManningFan wrote:
Don't ask why, this is just something a client wants to do...

I want to put a form in my database with 4 text boxes; txtA, txtB,
txtFormula and txtValue

The client wants to be able to enter numbers into txtA and txtB. He
then wants to be able to enter a formula in txtFormula and spit the
value into txtValue.

So, for instance, he enters 6 into txtA and 10 into txtB. In
txtFormula he types; (txtA + txtB) / 2

txtValue should then display the number 8.

Is this possible?
txtA = 1
txtb = 2
? Eval((txtA + txtB) / 2)
1.5

Jun 4 '07 #2
On Jun 4, 12:07 pm, salad <o...@vinegar.comwrote:
ManningFan wrote:
Don't ask why, this is just something a client wants to do...
I want to put a form in my database with 4 text boxes; txtA, txtB,
txtFormula and txtValue
The client wants to be able to enter numbers into txtA and txtB. He
then wants to be able to enter a formula in txtFormula and spit the
value into txtValue.
So, for instance, he enters 6 into txtA and 10 into txtB. In
txtFormula he types; (txtA + txtB) / 2
txtValue should then display the number 8.
Is this possible?

txtA = 1
txtb = 2
? Eval((txtA + txtB) / 2)
1.5- Hide quoted text -

- Show quoted text -
For some reason that works when you do it like that, but not when you
do Eval(Me.txtFormula). I know I'm close, just not quite there yet.

Jun 4 '07 #3

"ManningFan" <ma********@gmail.comwrote in message
news:11*********************@o5g2000hsb.googlegrou ps.com...
On Jun 4, 12:07 pm, salad <o...@vinegar.comwrote:
ManningFan wrote:
Don't ask why, this is just something a client wants to do...
I want to put a form in my database with 4 text boxes; txtA, txtB,
txtFormula and txtValue
The client wants to be able to enter numbers into txtA and txtB. He
then wants to be able to enter a formula in txtFormula and spit the
value into txtValue.
So, for instance, he enters 6 into txtA and 10 into txtB. In
txtFormula he types; (txtA + txtB) / 2
txtValue should then display the number 8.
Is this possible?
txtA = 1
txtb = 2
? Eval((txtA + txtB) / 2)
1.5- Hide quoted text -

- Show quoted text -

For some reason that works when you do it like that, but not when you
do Eval(Me.txtFormula). I know I'm close, just not quite there yet.
I think you will need to better define txtA and txtB.

? Evail(([txtA] + [txtB]) / 2)

You will more likely need to define a function to parse the formula and
return a value.
Jun 4 '07 #4
On Jun 4, 2:02 pm, "paii, Ron" <p...@packairinc.comwrote:
"ManningFan" <manning...@gmail.comwrote in message

news:11*********************@o5g2000hsb.googlegrou ps.com...
On Jun 4, 12:07 pm, salad <o...@vinegar.comwrote:
ManningFan wrote:
Don't ask why, this is just something a client wants to do...
I want to put a form in my database with 4 text boxes; txtA, txtB,
txtFormula and txtValue
The client wants to be able to enter numbers into txtA and txtB. He
then wants to be able to enter a formula in txtFormula and spit the
value into txtValue.
So, for instance, he enters 6 into txtA and 10 into txtB. In
txtFormula he types; (txtA + txtB) / 2
txtValue should then display the number 8.
Is this possible?
txtA = 1
txtb = 2
? Eval((txtA + txtB) / 2)
1.5- Hide quoted text -
- Show quoted text -
For some reason that works when you do it like that, but not when you
do Eval(Me.txtFormula). I know I'm close, just not quite there yet.

I think you will need to better define txtA and txtB.

? Evail(([txtA] + [txtB]) / 2)

You will more likely need to define a function to parse the formula and
return a value.- Hide quoted text -

- Show quoted text -
I got it. I had to use a Replace function to make it insert Forms!
frmExample.txtA wherever it found txtA, and likewise for txtB. For
whatever reason it understands the fields in the Immediate window but
doesn't understand them if you leave it in code.

Access is quirky sometimes...

Jun 4 '07 #5
On Mon, 04 Jun 2007 08:41:14 -0700, ManningFan <ma********@gmail.comwrote:
>Don't ask why, this is just something a client wants to do...

I want to put a form in my database with 4 text boxes; txtA, txtB,
txtFormula and txtValue

The client wants to be able to enter numbers into txtA and txtB. He
then wants to be able to enter a formula in txtFormula and spit the
value into txtValue.

So, for instance, he enters 6 into txtA and 10 into txtB. In
txtFormula he types; (txtA + txtB) / 2

txtValue should then display the number 8.

Is this possible?
Don't suppose the client would be happy with just a command button to open the
Windows Calculator.

Chuck
--

Jun 4 '07 #6
On Jun 4, 4:16 pm, Chuck <libb...@schoollink.netwrote:
On Mon, 04 Jun 2007 08:41:14 -0700, ManningFan <manning...@gmail.comwrote:
Don't ask why, this is just something a client wants to do...
I want to put a form in my database with 4 text boxes; txtA, txtB,
txtFormula and txtValue
The client wants to be able to enter numbers into txtA and txtB. He
then wants to be able to enter a formula in txtFormula and spit the
value into txtValue.
So, for instance, he enters 6 into txtA and 10 into txtB. In
txtFormula he types; (txtA + txtB) / 2
txtValue should then display the number 8.
Is this possible?

Don't suppose the client would be happy with just a command button to open the
Windows Calculator.

Chuck
--- Hide quoted text -

- Show quoted text -
It's a bit deeper than that, actually. Although even if it wasn't,
clients are never satisfied with solutions like that.

Jun 4 '07 #7
I haven't tried it but you could try the Eval function. Mmmm...I must make a
note to try that.

Else you probably have to parse it and then human error will be a problem.

Tricky.

Jeff
"More Access Stuff."
http://www.asken.com.au

"ManningFan" <ma********@gmail.comwrote in message
news:11**********************@k79g2000hse.googlegr oups.com...
Don't ask why, this is just something a client wants to do...

I want to put a form in my database with 4 text boxes; txtA, txtB,
txtFormula and txtValue

The client wants to be able to enter numbers into txtA and txtB. He
then wants to be able to enter a formula in txtFormula and spit the
value into txtValue.

So, for instance, he enters 6 into txtA and 10 into txtB. In
txtFormula he types; (txtA + txtB) / 2

txtValue should then display the number 8.

Is this possible?

Jun 5 '07 #8
Try Eval(Me!txtFormula).

The '.' should be '!'.

Jeff
"More Access Stuff."
http://www.asken.com.au

"ManningFan" <ma********@gmail.comwrote in message
news:11*********************@o5g2000hsb.googlegrou ps.com...
On Jun 4, 12:07 pm, salad <o...@vinegar.comwrote:
>ManningFan wrote:
Don't ask why, this is just something a client wants to do...
I want to put a form in my database with 4 text boxes; txtA, txtB,
txtFormula and txtValue
The client wants to be able to enter numbers into txtA and txtB. He
then wants to be able to enter a formula in txtFormula and spit the
value into txtValue.
So, for instance, he enters 6 into txtA and 10 into txtB. In
txtFormula he types; (txtA + txtB) / 2
txtValue should then display the number 8.
Is this possible?

txtA = 1
txtb = 2
? Eval((txtA + txtB) / 2)
1.5- Hide quoted text -

- Show quoted text -

For some reason that works when you do it like that, but not when you
do Eval(Me.txtFormula). I know I'm close, just not quite there yet.

Jun 5 '07 #9
On Jun 5, 7:40 am, "Jeff" <jeff.pritch...@asken.com.auwrote:
Try Eval(Me!txtFormula).

The '.' should be '!'.

Jeff
"More Access Stuff."http://www.asken.com.au

"ManningFan" <manning...@gmail.comwrote in message

news:11*********************@o5g2000hsb.googlegrou ps.com...
On Jun 4, 12:07 pm, salad <o...@vinegar.comwrote:
ManningFan wrote:
Don't ask why, this is just something a client wants to do...
I want to put a form in my database with 4 text boxes; txtA, txtB,
txtFormula and txtValue
The client wants to be able to enter numbers into txtA and txtB. He
then wants to be able to enter a formula in txtFormula and spit the
value into txtValue.
So, for instance, he enters 6 into txtA and 10 into txtB. In
txtFormula he types; (txtA + txtB) / 2
txtValue should then display the number 8.
Is this possible?
txtA = 1
txtb = 2
? Eval((txtA + txtB) / 2)
1.5- Hide quoted text -
- Show quoted text -
For some reason that works when you do it like that, but not when you
do Eval(Me.txtFormula). I know I'm close, just not quite there yet.- Hide quoted text -

- Show quoted text -
Jeff -
I tried that already. I had to actually specify the form name in
order to get it to work.

Jun 5 '07 #10
Mmm, interesting. At least it works for you.

Jeff
"More Access Stuff."
http://www.asken.com.au

"ManningFan" <ma********@gmail.comwrote in message
news:11*********************@q66g2000hsg.googlegro ups.com...
On Jun 5, 7:40 am, "Jeff" <jeff.pritch...@asken.com.auwrote:
>Try Eval(Me!txtFormula).

The '.' should be '!'.

Jeff
"More Access Stuff."http://www.asken.com.au

"ManningFan" <manning...@gmail.comwrote in message

news:11*********************@o5g2000hsb.googlegro ups.com...
On Jun 4, 12:07 pm, salad <o...@vinegar.comwrote:
ManningFan wrote:
Don't ask why, this is just something a client wants to do...
I want to put a form in my database with 4 text boxes; txtA, txtB,
txtFormula and txtValue
The client wants to be able to enter numbers into txtA and txtB. He
then wants to be able to enter a formula in txtFormula and spit the
value into txtValue.
So, for instance, he enters 6 into txtA and 10 into txtB. In
txtFormula he types; (txtA + txtB) / 2
txtValue should then display the number 8.
Is this possible?
>txtA = 1
txtb = 2
? Eval((txtA + txtB) / 2)
1.5- Hide quoted text -
>- Show quoted text -
For some reason that works when you do it like that, but not when you
do Eval(Me.txtFormula). I know I'm close, just not quite there yet.-
Hide quoted text -

- Show quoted text -

Jeff -
I tried that already. I had to actually specify the form name in
order to get it to work.

Jun 7 '07 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: TomHL | last post by:
Hello all, I need to do an application that takes a Bitmap object and convert it to one of the color tables below: 1. 16 colors. 2. 256 colors. 3. 24bpp. I read about lockbits and unsafe...
0
by: Srijith Augustine | last post by:
Hi, Record selection Formaula is not working while exporting the report to Excel There is absolutely no problem while using a crystal report viewer but if i export it to a excel the selection...
5
by: Masahiro Ito | last post by:
I have column of data that have elapsed time in minutes. For example: 1:15 1:47 23:12 I like to be able to use sql server to do simple math functions. Does anyone have a simple...
3
by: SiewSa | last post by:
I have come to a situation that I need to use the result of a string variable as a formula for performing calculation. As an example below: Dim X As Integer Dim Y As Integer Dim Result...
12
by: Jack Daly | last post by:
I've inherited some code which uses an undocumented feature of a third-party vendor's library. Essentially, this vendor has kept the details of an interface struct secret, but we can pass a pointer...
116
by: Dilip | last post by:
Recently in our code, I ran into a situation where were stuffing a float inside a double. The precision was extended automatically because of that. To make a long story short, this caused...
1
by: barnzee | last post by:
Hi all, newbie here, but having a go I am trying to build a stock watchlist in excel 2007 with a dynamic link to a DDE server (paid for from a broker).There is no add-in or plug-in, I just CTL ALT...
0
by: humberto.bortolossi | last post by:
Greetings! I would like to know if there is a C library (free or not) that converts a string formula to TeX code. For instance, "(a + b)/2" is converted to "\frac{a + b}{2}". Thanks in...
1
by: =?Utf-8?B?bGF3ODc4Nw==?= | last post by:
i am looking for some MS Excel formula or MS Visal Basic Marco for converting Date to Lunar Date. tks
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.