这是不同的:将公式转换为值 [英] This is different: Converting a formula to a value

查看:83
本文介绍了这是不同的:将公式转换为值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不要问为什么,这只是客户想要做的事情......


我想在我的数据库中放一个带有4个文本框的表格; txtA,txtB,

txtFormula和txtValue


客户希望能够在txtA和txtB中输入数字。然后他希望能够在txtFormula中输入一个公式并将

值吐入txtValue。


所以,对于例如,他将6输入txtA,将10输入txtB。在

txtFormula中他输入; (txtA + txtB)/ 2

txtValue应显示数字8.


这可能吗?

解决方案

ManningFan写道:


不要问为什么,这只是一个客户端想做...


我想在我的数据库中放一个带有4个文本框的表格; txtA,txtB,

txtFormula和txtValue


客户希望能够在txtA和txtB中输入数字。然后他希望能够在txtFormula中输入一个公式并将

值吐入txtValue。


所以,对于例如,他将6输入txtA,将10输入txtB。在

txtFormula中他输入; (txtA + txtB)/ 2

txtValue应显示数字8.


这可能吗?


txtA = 1

txtb = 2

? Eval((txtA + txtB)/ 2)

1.5


6月4日下午12:07,沙拉< o ... @ vinegar.comwrote:


ManningFan写道:


不要问为什么,这只是客户想做的事情......


我想在我的数据库中放一个带有4个文本框的表格; txtA,txtB,

txtFormula和txtValue


客户希望能够在txtA和txtB中输入数字。然后他想要能够在txtFormula中输入一个公式并将

值吐入txtValue。


因此,例如,他将6输入txtA,将10输入txtB。在

txtFormula中他输入; (txtA + txtB)/ 2


txtValue应显示数字8.


这可能吗?



txtA = 1

txtb = 2

? Eval((txtA + txtB)/ 2)

1.5-隐藏引用文字 -


- 显示引用文字 -



出于某种原因,当你这样做的时候会这样做,但是当你这么做的时候不会这样做。(E.txtFormula)。我知道我很接近,但还没有到那里。




" ManningFan" < ma ******** @ gmail.com写信息

新闻:11 ********************* @ o5g2000hsb.googlegrou ps.com ...


6月4日下午12:07,沙拉< o ... @ vinegar.comwrote:


ManningFan写道:


不要问为什么,这只是客户想做的事情......


我想在我的数据库中放置一个带有4个文本框的表单; txtA,txtB,

txtFormula和txtValue


客户希望能够在txtA和txtB中输入数字。然后他想要能够在txtFormula中输入一个公式并将

值吐入txtValue。


因此,例如,他将6输入txtA,将10输入txtB。在

txtFormula中他输入; (txtA + txtB)/ 2


txtValue应显示数字8.


这可能吗?



txtA = 1

txtb = 2

? Eval((txtA + txtB)/ 2)

1.5-隐藏引用文字 -


- 显示引用文字 -



出于某种原因,当你这样做的时候会有效,但是当你这么做的时候不会这样做。(E.txtFormula)。我知道我很接近,还没到那里。



我认为你需要更好地定义txtA和txtB。


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


您更可能需要定义一个函数来解析公式并且

返回一个价值。


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?

解决方案

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


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.



"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.


这篇关于这是不同的:将公式转换为值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆