test keycode for alphanumeric character


i have a keydown event and only want to run if an alphanumeric character is pressed. i think this is a UDF requirement.

how would yall design it? if yall could share even some air code that would be great!!

i'm so so sorry i'm so super overloaded now!!

i'm thinking something like convert the keycode to alpha and then test it for >=A <=z and also for numbers. can't think of the exact implementation but something along those lines! thanks guys!! = ))
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Anthony BerenguelCommented:
Here's an example I have used before -- you will need to modify the selection statement to fit your needs.

Private Sub cbxControl_ID_KeyPress(KeyAscii As Integer)
    Debug.Print KeyAscii
    If KeyAscii = 27 Then 'esc key
        Me.cbxControl_ID.Width = 1440
    End If
End Sub

Open in new window

Alphanumeric characters are in some range in ascii table:
Keycode 48-57 : numbers from 0 to 9
65-90 : A-Z
97-122 : a-z
so you can check code without conversion:
If keycode >47 and keycode < 58 then 'numeric

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
developingprogrammerAuthor Commented:
great! thanks aebea and als315!! = ))
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.