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 / September 2007

Tip: Looking for answers? Try searching our database.

key combination help!

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
riccifs@tin.it - 08 Sep 2007 13:17 GMT
Hi to everyone in N.G.
I would like to known if there is a way to assign keyboard shortcuts,
like Ctrl+G or
Ctrl+F3, by VBA code?

This is my code:
-----------------------------------------------------------------------
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
   If KeyCode = vbKeyTab Then
       Screen.ActiveControl.Text = StrConv(Screen.ActiveControl.Text,
vbProperCase)
   End If
End Sub
-------------------------------------------------------------------------
Private Sub Form_Load()
   Me.KeyPreview = True
End Sub
-------------------------------------------------------------------------
Insted of use vbKeyTab, I'd like to use Ctrl+G or any other key
cobination, to fire the code!
Is it possible? if not, how I have to change the above code?
I hope sameone will give to me an answer...
Thanks a lot,
Stefano.
Ken Snell (MVP) - 08 Sep 2007 13:52 GMT
Check out AutoKeys macro in Help file. Use that to "assign" that key
combination to a specific macro or VBA public function that you want to run
when you press that key combination.

Signature

       Ken Snell
<MS ACCESS MVP>

> Hi to everyone in N.G.
> I would like to known if there is a way to assign keyboard shortcuts,
[quoted text clipped - 20 lines]
> Thanks a lot,
> Stefano.
Linq Adams - 08 Sep 2007 14:35 GMT
And if you're trying to simply change the data to proper case you're making
extra work for your users! The standard way to do this requires no
interaction from them!

Private Sub YourControlName_AfterUpdate()
Me.YourControlName = StrConv(Me.YourControlName, vbProperCase)
End Sub

Signature

There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000

John W. Vinson - 09 Sep 2007 01:01 GMT
>Private Sub YourControlName_AfterUpdate()
> Me.YourControlName = StrConv(Me.YourControlName, vbProperCase)
>End Sub

Or (to prevent the code from undoing carefully constructed correct
capitalization):

If StrComp(Me.YourControlName, LCase(Me.YourControlName), 0) = 0 Then
  Me.YourControlName = StrConv(Me.YourControlName, vbProperCase)
End If

            John W. Vinson [MVP]
 
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.