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 / April 2005

Tip: Looking for answers? Try searching our database.

Key Down Event Question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jeff - 05 Apr 2005 11:53 GMT
Hello,

If I have a Text Box & if I want that everytime someone types in a space
then to not put a Space in to just move the cursor one position to the right.
I am able to do this with VBA coding with the following:

Private Sub txtHourlyRate_KeyDown(KeyCode As Integer, Shift As Integer)

 '*** If Space is hit doesnt put space just uses Right Arrow & moves right 1
 If KeyCode = 32 Then KeyCode = 39

End Sub

But for the Form I am building I will have a lot of Text Boxes that I want
to do the same for.  What I am looking for is help on how I can save time
instead of typing in all these KeyDown Events for each control.  I know VBA
doesnt have control arrarys, so another Idea I thought of was in the
Properites, in the KeyDown Event to put a Function in, & then in the Function
change the Space to the Right Arrow.
But for the Proporties function how can I pass the "KeyCode" number so I
know what is being typed ?  Can this even be done ? I hope I didnt confuse
anyone.

Any help would be greatly appreciated.

Thank you,
Jeff
Mark Phillipson - 05 Apr 2005 16:06 GMT
Hi,

One option may be to use the Form KeyDown Event.  (Note you will need to set
the Key Preview form property to Yes)

Signature

HTH

Mark Phillipson

Free Add-Ins at; http://mphillipson.users.btopenworld.com/

> Hello,
>
[quoted text clipped - 27 lines]
> Thank you,
> Jeff
 
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.