Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / August 2005

Tip: Looking for answers? Try searching our database.

Getting ASCII code on KeyPress event

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Seth - 05 Aug 2005 02:56 GMT
I want to prevent characters other than the following from being entered into
a text box:

‘0’ to ‘9’
‘A’ to ‘Z’ (upper case only)
‘.’ (full stop)
‘-‘ (minus sign)

I have tried using the KeyPress event and setting KeyCode to null but there
is no KeyCode for ‘.’ or ‘-‘. Also it dose not differentiate between upper
case and lower case.

Can I retrieve the ASCII value of the character entered within the KeyPress
event procedure?

Cheers,
Seth
Dirk Goldgar - 05 Aug 2005 03:02 GMT
> I want to prevent characters other than the following from being
> entered into a text box:
[quoted text clipped - 10 lines]
> Can I retrieve the ASCII value of the character entered within the
> KeyPress event procedure?

Are you sure you've been looking at the KeyPress event and not the
KeyDown event?  The KeyPress event procedure receives an argument,
KeyAscii As Integer, which is the ASCII value of the key that was
pressed.  Note that non-ASCII keys will fire KeyDown and not KeyPress.

Signature

Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.