Answered by:
Issues with Enter Key functinality on Text box

Question
-
Fellow Accessers,
I have a scenario where I do not understand why the enter key becomes none functioning.
I have text box A, after you enter data and press the enter key, the app makes another text box B visible and with emtpy data in B.
if they choose not to use B, they can click back on A and the code turns off Visbility to B.
so know we are sitting back on A. the Enter button no longer functions until you make a change to it.
There is keypress events in all boxes to permit Enter (Ascii 13). I have tried wipping out A, reloading A thru code in the gotfocus but no dice.
Does anyone have an idea why Enter is becoming disabled?
thanks,
MG
Wednesday, August 17, 2016 3:21 PM
Answers
-
So, if I understand it correctly, it really has something to do with the code you want to execute. If you want to affect Textbox B when you "leave" Textbox A whether you update it or not, perhaps you can use the Exit event rather than the After or Before Update event. Just a thought...
- Marked as answer by mg30 Wednesday, August 17, 2016 7:29 PM
Wednesday, August 17, 2016 4:39 PM
All replies
-
Hi MG. My guess is you may have code modifying the default behavior. Do you have the same problem if you create a new form without code?Wednesday, August 17, 2016 3:23 PM
-
HI DB Guy,
Nope. I just did a test with a blank DB and that is apparently how it works.
I had a blank form.
Text box a. text box b
A is visible
B is invisible.
When I enter data in A and press enter, I make B visible in After_Update. Then if I click A again, if b is visible, I make B visible false and wipe the text.
The test worked the same as my app. When you go back to the A box and DO NOT touch the original code, the Enter key no longer fires which makes sense because there is no UPDATE to the text field. If you enter text, it will fire.
If I force a different value in A when I unload B, it still will not fire. Apparently Access does not set the internal events to detect an update.
Wednesday, August 17, 2016 4:31 PM -
So, if I understand it correctly, it really has something to do with the code you want to execute. If you want to affect Textbox B when you "leave" Textbox A whether you update it or not, perhaps you can use the Exit event rather than the After or Before Update event. Just a thought...
- Marked as answer by mg30 Wednesday, August 17, 2016 7:29 PM
Wednesday, August 17, 2016 4:39 PM -
HI DB guy,
Thanks. Yep, that was it. Moving our logic to Exit took care of it. Enter key now works like it should.
Many thanks.
MG
Wednesday, August 17, 2016 7:30 PM -
Hi MG. You're welcome. Glad we could assist. Good luck with your project.Wednesday, August 17, 2016 8:30 PM