Results 1 to 11 of 11
  1. #1
    Paul H's Avatar
    Paul H is offline Expert
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Location
    Richmond, VA
    Posts
    591

    Hack for scrolling through a tabbed form.

    I'd like Access to let me use Ctrl-PgUp and Ctrl-PgDn to scroll through a tab control on a form. I've looked through a variety of Keystroke combinations looking for Ascii codes, preferably Ctl-Page Up or Page Down, but no luck. Even if I did, I'm not sure where to put the event. I'd also like to put an event on the Esc key to close certain forms with a single keystroke. No luck there either.



    This falls under the heading of idle curiosity, but if I knew how to do it, I would definitely put it to good use.

    Thanks in advance.

    Paul

  2. #2
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Quote Originally Posted by Paul H View Post
    I'd like Access to let me use Ctrl-PgUp and Ctrl-PgDn to scroll through a tab control on a form.
    I'm not really sure I understand what you want to do. Do you mean you have, say, 10 tabs for a tab control and you want to use Ctrl-PgUp to move from Tab1 to Tab2??

    In one dB I have, I am using the F12 key to open a more detailed form for a specific control. Then, in that form, pressing F12 in a specific control opens another more detailed form.... kind of drilling down 2 levels deep.

    So I think it might be able to be done, I just don't understand what it is you are trying to do...

  3. #3
    Paul H's Avatar
    Paul H is offline Expert
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Location
    Richmond, VA
    Posts
    591
    All I am trying to do is navigate the tabbed form using the key board instead of the mouse. All that happens when I hit F12 is a Save As dialog box.

  4. #4
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Didn't answer my questions....

    Quote Originally Posted by Paul H View Post
    All I am trying to do is navigate the tabbed form using the key board instead of the mouse.
    Again......Do you mean you have, say, 10 tabs for a tab control and you want to use Ctrl-PgUp to move from Tab1 to Tab2??
    You have not described the form design, nor posted an image of your form.


    Quote Originally Posted by Paul H View Post
    All that happens when I hit F12 is a Save As dialog box.
    Again, I said "I am using the F12 key to open a more detailed form for a specific control". I programmed the F12 key to do something different than the default behavior. The first form has one behavior when F12 is pressed, the other form has a different behavior when the F12 key is pressed.


    Maybe post your dB for analysis....

  5. #5
    Paul H's Avatar
    Paul H is offline Expert
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Location
    Richmond, VA
    Posts
    591
    Again......Do you mean you have, say, 10 tabs for a tab control and you want to use Ctrl-PgUp to move from Tab1 to Tab2??
    You have not described the form design, nor posted an image of your form.
    Yes, that is exactly what I am trying to do. I am a keyboard warrior. If I have my hands on the keyboard, I prefer to keep them there and use keyboard shortcuts and hot keys. I add my own where possible, I just haven't figured out this one.

    Again, I said "I amusing the F12 key to open a more detailed form for a specific control". I programmed the F12 key to do something different than the default behavior. The first form has one behavior when F12 is pressed, the other form has a different behavior when the F12 key is pressed
    I realized that after I posted my reply.

  6. #6
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,822
    AFAIK
    There are no keyboard events for a tab control page. It's the pages you want to navigate, not the tab control. Your post title is confusing as well. The form isn't tabbed - it contains a tab control. The control has pages. God only knows why it's not a page control, or has "tabs" if it's a tab control. It was bad enough; now there is a navigation control with tabs and a tabbed view for forms - with or without the tabs!!

    AFAIK
    There are no such keyboard events for a page that will work unless the page has controls that can take the focus. It will accept Tab key; I don't know what else.
    I think you would have to
    - have a control on a page that can take the focus and if e.g. key press is Tab key, get the active page property
    Code:
    Property Get ActivePage() As Access.Page
      With Me.TabCtl0
        Set ActivePage = .Pages(.Value)
      End With
    End Property
    - call the function in that keypress event and get the page name and Case Select to the next tab while dealing with which way to go when you get to the rightmost page. Then set focus to a control on the new page. It could be transparent, no border and maybe even zero width so that it's not obvious, but you will see the cursor flashing.

    OR

    You could use a mouse like the Almighty M$ planned.
    Last edited by Micron; 02-28-2019 at 12:34 AM. Reason: clarification & added info
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  7. #7
    Paul H's Avatar
    Paul H is offline Expert
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Location
    Richmond, VA
    Posts
    591
    OR

    You could use a mouse like the Almighty M$ planned.

  8. #8
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    If I understood you correctly, take a look at the example dB.

    There is a tab control with 5 pages. The form, "Form1", is bound to Table1 just to have a couple of records.

    As long as the form has focus, pressing {Alt+Page Up} or {Alt+Page down} moves through the tab control pages.

    Took a while to modify my code to get it to work with the Page Up/Page Down keys.



    Close???
    Attached Files Attached Files

  9. #9
    Paul H's Avatar
    Paul H is offline Expert
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Location
    Richmond, VA
    Posts
    591
    Looks very close. I've popped it in my form's keydown event, but I can't get it to fire. BTW, my form is structured just like yours, except my tab control is in the detail section. I don't know if that would make any difference. I have some other pressing matters which can't wait, but I'll return with my full reply asap, possibly Monday.

  10. #10
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,822
    I can't get it to fire
    Works for me.
    EDIT - never mind. I see that you meant in your own code.

    Don't understand why the tab control is in the footer though. Works even as a single form view with no controls and tab control in the detail section. The magic is in putting the event on the form, not the control or its pages.
    It reminds me of why I keep hanging around here. Great place to learn stuff - especially tricks!

  11. #11
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Quote Originally Posted by Paul H View Post
    Looks very close. I've popped it in my form's keydown event, but I can't get it to fire. BTW,
    Oops, I might have forgot to mention that the form "Key Preview" property must be set to TRUE. (Form Properties - Event tab - last property)
    As I understand it, this allows the FORM to see the key strokes FIRST. If the code is not programmed to do anything with the key combination/code, then the control receives the key code(s).


    As to why the tab control is in the form footer...... why not?
    Actually, I tend to put sub forms in the form footer with both the main form and the sub form set to continuous form views. After setting the linking fields, Access complains and sets (Usually) the main form back to single form view. Then I set both forms back to continuous form views - life is good..
    So, since it was an example form, I put the tab control into the footer just because.

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

Similar Threads

  1. Replies: 7
    Last Post: 02-15-2019, 08:26 AM
  2. Scrolling records on non-continuous form
    By Euler271 in forum Programming
    Replies: 2
    Last Post: 04-11-2018, 09:08 AM
  3. Replies: 4
    Last Post: 02-11-2016, 11:22 AM
  4. Scrolling through Sub-Form Records
    By wscwt01 in forum Access
    Replies: 1
    Last Post: 06-27-2014, 02:29 PM
  5. Career Advice for an Access/VBA Hack
    By Paul H in forum General Chat
    Replies: 1
    Last Post: 01-29-2013, 09:03 AM

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