My Assistant
![]() ![]() |
|
|
Dec 1 2005, 07:03 PM
Post
#1
|
|
|
UtterAccess Guru Posts: 753 From: Rendon, Texas |
Hello UA,
I have a number of cmdButtons on a Parent Form that changes the SourceObject of a subform. I would like to give the user the option of using the Right Arrow key to SetFocus on the subform. I know I can do this on each cmdButton using the KeyDown event but what I rather do is create a function to accomplish this so I don't have to code each and every button. My problem is I'm new to creating functions, subs and etc. Could I get someone to lend a hand in accomplishing this, please? TIA, Shane |
|
|
|
Dec 1 2005, 10:21 PM
Post
#2
|
|
|
UtterAccess Guru Posts: 753 From: Rendon, Texas |
Been searching but just not coming up with anything on my own. No one want to take a stab at it?
|
|
|
|
Dec 1 2005, 11:36 PM
Post
#3
|
|
|
UtterAccess Veteran Posts: 345 From: California |
Hello:
Try this: Private Sub Form_Load() Me.KeyPreview = True End Sub Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) Select Case KeyCode Case vbKeyRight MsgBox "Right arrow pressed" forms!YourFormname.SetFocus Case Else Your code statements End Select End Sub Regards Mark |
|
|
|
Dec 1 2005, 11:41 PM
Post
#4
|
|
|
UtterAccess Veteran Posts: 345 From: California |
Hello
The above code works if I place a textbox and command button on a form and press the right arrow. The message box fired back and the focus move to a command button. I hope this is what your after. Regards Mark |
|
|
|
Dec 1 2005, 11:57 PM
Post
#5
|
|
|
UtterAccess Guru Posts: 753 From: Rendon, Texas |
Thanks Mark. That is what I was after.
Shane |
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 25th May 2013 - 11:06 PM |