Calculate within a Textbox

  • Thread starter Thread starter Arvin Villodres
  • Start date Start date
A

Arvin Villodres

Good day to everyone!

I want to compute inside a text box and after pressing
enter the output will be seen on the same text box.

Example: txtValue

I will type 4562 + 3 in the txtValue and after pressing
enter 4565 or the summ will appear on txtValue. I want to
do this using multiplication, division and subtration
also. Can I also do this 98 + (56 - 4)? Can I also do this
on a subform?

Thanks for the help!
 
Arvin Villodres said:
Good day to everyone!

I want to compute inside a text box and after pressing
enter the output will be seen on the same text box.

Example: txtValue

I will type 4562 + 3 in the txtValue and after pressing
enter 4565 or the summ will appear on txtValue. I want to
do this using multiplication, division and subtration
also. Can I also do this 98 + (56 - 4)? Can I also do this
on a subform?

Unfortunately, you can't do it in a subform unless you bind it to a query,
and then you can't use the same textbox. You can do it in a single form view
by using the Eval function like this:

Private Sub txtText1_AfterUpdate()
Me.txtText1 = Eval(Me.txtText1)
End Sub

BTW, where did you get an odd name like Arvin? <grin>
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
Thanks for the reply.

About my name, I guess a lot of us have the same name.
Maybe I should ask the same question to. (smile)
 
Back
Top