jerseyanne
asked on
Automate ESC key through Macro or VB code
I have a combo box that finds records. User wants to see the dropdown list as soon as entering box, no problem. Once the user determines that the record they arelooking for is not in the database they want to create it. To get to the new record form they will have to ESC to get the dropdown list to disappear and then ESC again to get the typed text to revert back to last item typed or to a blank box, otherwise I get the "not in list" error message. Is there a way to automate the ESC key instead of having to type it twice?
ASKER
Where do I put the code, on an event or what?
ASKER
I figured out where to put the sendkeys but not the Me.Undo.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That worked great, thanks.
Your welcome, why the "B" grade?
ASKER
I am not quite sure how the grading system works quite yet.
I tried to add some additional Sendkeys commands ({DEL}{ESC}) to the same form after the first set and started getting errors. Those keys worked on the form directly so I am not sure why they didn't work in the macro.
Since I put the action for the Sendkeys in a macro, your answer on the Me.undo still didn't help me since that, I would assume, goes into code somewhere not in the macro action.
Bottom line, it was very late at night and some of your explanations were vague so that's why I assessed the answer to be valued with a B. If there is a way to upgrade it to an A just let me know. I don't have time right now to research how to do that.
I tried to add some additional Sendkeys commands ({DEL}{ESC}) to the same form after the first set and started getting errors. Those keys worked on the form directly so I am not sure why they didn't work in the macro.
Since I put the action for the Sendkeys in a macro, your answer on the Me.undo still didn't help me since that, I would assume, goes into code somewhere not in the macro action.
Bottom line, it was very late at night and some of your explanations were vague so that's why I assessed the answer to be valued with a B. If there is a way to upgrade it to an A just let me know. I don't have time right now to research how to do that.
If that doesn't do it, try
SendKeys "{Esc}{Esc}"