Link to home
Start Free TrialLog in
Avatar of Krobar
Krobar

asked on

Instant update of calculated Text Box in Form

I have a form which contains a Text Box which calculates a value from a user input text box on the same form.

The trouble is it only does this once the user has stopped typing and clicks somewhere else. I assume I have to put some sort of expression into the correct event property of the user input text box but dont know an expression to force uppdate of another text box. Does anyone know?
Avatar of dannywareham
dannywareham
Flag of United Kingdom of Great Britain and Northern Ireland image

Other controls will update when the focus changes from control to control.

It is possible to do an update through code, by placing it on the OnKeyDown event.
However, if you're using calculated fields, this will cause errors that will have to be managed too.
Another event that can do the trick is the OnChange. Use anyway for your calculation the Nvl function to avoid calculation problems.
Avatar of Krobar
Krobar

ASKER

This seems alot more difficult than I thought it would be (I upped the points too). I tried entering simple piece of code but it does not execute when I expect.

For example if you have two text boxes called Text1 & Text2 and I wanted to update Text2 (which has no control source) using the following "Text2.Value = Text1.Value * 5" every time a key is pressed in Text1, how is this done?
I can't find a way to do it whilst you still have focus on text1.

Having the focus on the control that is part of a calculated field stops the events from firing - so you can't use the Timer event on the form either.
ASKER CERTIFIED SOLUTION
Avatar of Markus Fischer
Markus Fischer
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial