Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 445
  • Last Modified:

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?
0
jerseyanne
Asked:
jerseyanne
  • 4
  • 3
1 Solution
 
thenelsonCommented:
Me. Undo
If that doesn't do it, try
SendKeys "{Esc}{Esc}"
0
 
jerseyanneAuthor Commented:
Where do I put the code, on an event or what?
0
 
jerseyanneAuthor Commented:
I figured out where to put the sendkeys but not the Me.Undo.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
thenelsonCommented:
The Me.Undo would go where you put the SendKeys instead of SendKeys.  It is preferable to SendKeys.
0
 
jerseyanneAuthor Commented:
That worked great, thanks.
0
 
thenelsonCommented:
Your welcome, why the "B" grade?
0
 
jerseyanneAuthor Commented:
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.

0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now