Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

allow tab key in select case for ascii vba

Posted on 2016-09-16
2
Medium Priority
?
61 Views
Last Modified: 2016-09-16
i'm having an issue that when a person presses a  <tab> key going from textbox to textbox,

The code below is firing off in the next textbox in the tab order. even though I have not pressed keys in that next textbox yet  ?

The event i have it on is..
Private Sub QUOTE_GP_KeyPress(KeyAscii As Integer)

Select Case True 'always your best friend
    Case (KeyAscii > 47 And KeyAscii < 58)
    Case (KeyAscii = 8)
    Case (KeyAscii = 43)
    Case (KeyAscii = 45)
    Case (KeyAscii = 46)
    Case Else
      '  MsgBox ("quote gp You Must Enter Numbers Only!")
        KeyAscii = 0
        Exit Sub
End Select

Open in new window

0
Comment
Question by:fordraiders
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 39

Accepted Solution

by:
PatHartman earned 2000 total points
ID: 41801848
That actually makes sense.  The tab key is being passed to the control that has the focus.  I find the keypress event to be more trouble than it is worth and it is not the appropriate event for your purpose anyway.

If you want to trap each key as it is typed into a control, use the control's On Change event.
0
 
LVL 3

Author Closing Comment

by:fordraiders
ID: 41802112
THNX
0

Featured Post

10 Questions to Ask when Buying Backup Software

Choosing the right backup solution for your organization can be a daunting task. To make the selection process easier, ask solution providers these 10 key questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question