Results 1 to 3 of 3
  1. #1
    SCFM is offline Novice
    Windows XP Access 2010 (version 14.0)
    Join Date
    Feb 2010
    Posts
    13

    Accessing a Tab with a HotKey

    I have a Form with a 3 pages Tab Control. I'm trying to SetFocus in page x with a Hot Key using VB.

    To do that I needed to:
    1. Create an Event (I choose On Key Down):
    2. Write the code

    Both are not working. I mean I tried the following code for the event but It doesn't work:



    Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    MsgBox "Key Down"
    End Sub

    I am thinking to use the following code for the page focusing.

    Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyF8 Then
    Me!TabCtl1.Pages(3).SetFocus
    End Sub

    Thank you.

  2. #2
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    i wonder if you could either use:

    1) the hotkey code on a property sheet

    2) focusing on the tabs you want based on the key you pressed.



    1) to do this, I have put something like "&Hide" in the caption property of a cmd button. hence, the shortcut key for pushing the button is Ctrl+H. not sure if you can do that with tabs too, but you could try some focus code behind a button with a caption like "&1" or "&one"

    2) i think key press events are only limited to special keys, like tab, enter, etc... I am not sure if you can apply tis event to actual character strokes. I have tested this and I cannot get anything to print when pressing letters. so I think you're stuck with those special keys. if you want to check on the KEYCODE though, I think you'll need an integer. such as:
    Code:
    if keycode 69 then
       
    do something
    end 
    if 
    check out these articles for the integers that are assigned:

    http://support.microsoft.com/kb/113547

    http://support.microsoft.com/kb/210401

  3. #3
    SCFM is offline Novice
    Windows XP Access 2010 (version 14.0)
    Join Date
    Feb 2010
    Posts
    13

    Thumbs up

    Quote Originally Posted by ajetrumpet View Post
    i wonder if you could either use:

    1) the hotkey code on a property sheet

    2) focusing on the tabs you want based on the key you pressed.



    1) to do this, I have put something like "&Hide" in the caption property of a cmd button. hence, the shortcut key for pushing the button is Ctrl+H. not sure if you can do that with tabs too, but you could try some focus code behind a button with a caption like "&1" or "&one"

    2) i think key press events are only limited to special keys, like tab, enter, etc... I am not sure if you can apply tis event to actual character strokes. I have tested this and I cannot get anything to print when pressing letters. so I think you're stuck with those special keys. if you want to check on the KEYCODE though, I think you'll need an integer. such as:
    Code:
    if keycode 69 then
       
    do something
    end 
    if 
    check out these articles for the integers that are assigned:

    http://support.microsoft.com/kb/113547

    http://support.microsoft.com/kb/210401
    Thank you for your answer. For now I choose your first recommendation.
    I used Page&1, Page&2,... and it's working with ALT+1, Alt+2,...without
    any VB code. regards.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. adp accessing issue
    By fillerup in forum Security
    Replies: 3
    Last Post: 03-10-2010, 09:59 AM
  2. Accessing Table via asp Errors
    By KLynch0803 in forum Programming
    Replies: 1
    Last Post: 01-17-2010, 09:59 AM
  3. Accessing Code For a Query
    By TexMax007 in forum Programming
    Replies: 3
    Last Post: 08-29-2009, 08:08 AM
  4. Accessing form controls
    By dante in forum Forms
    Replies: 15
    Last Post: 07-28-2009, 08:26 AM
  5. Accessing subform fields
    By nkenney in forum Forms
    Replies: 1
    Last Post: 04-21-2009, 10:10 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums