key combination help!

R

riccifs

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.
 
K

Ken Snell \(MVP\)

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.
 
L

Linq Adams via AccessMonster.com

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

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

Answers/posts based on Access 2000

Message posted via AccessMonster.com
 
J

John W. Vinson

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]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top