Results 1 to 9 of 9
  1. #1
    2 Star Lounger
    Join Date
    Jun 2001
    Location
    Kenton, Delaware, USA
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Code Page Down (Access 2003)

    I have a form that has page breaks. I would like to navigate to next and previous from command buttons. What code would be used to trigger this click event?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Code Page Down (Access 2003)

    As far as I know, there is no method for this. You can use

    SendKeys "{PgDn}"

    and

    SendKeys "{PgUp}"

    in the On Click event procedure of the command buttons.

  3. #3
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Code Page Down (Access 2003)

    You can use GoToPage to go to a specific page number.

    You can either use docmd.GotoPage pagenumber

    or (according to Help) Me.GoToPage pagenumber

    It requires a specific page number as an argument, so to have buttons working as next/previous buttons, youy would need a variable to keep track of the current page, and then increment or decrement that variable.
    Regards
    John



  4. #4
    4 Star Lounger SteveH's Avatar
    Join Date
    Jan 2001
    Location
    Chelsea, Gtr London, United Kingdom
    Posts
    587
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Code Page Down (Access 2003)

    This method of doing a multi-page form has several problems associated with it. If your user tab keys through the form they can end up with half of a page showing. You will need to disable various key strokes to use this method effectively.

    A much more reliable way to implement this is to use a tab control and to use your command buttons to move through the tab pages. You can hide the tabs away so your user will not know they are on a tabbed form.

    Just my <img src=/S/2cents.gif border=0 alt=2cents width=15 height=15>
    Steve H
    IT Lecturer/Access Developer
    O2K SR3/O2010; Win7Pro

  5. #5
    2 Star Lounger
    Join Date
    Jun 2001
    Location
    Kenton, Delaware, USA
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Code Page Down (Access 2003)

    Exactly what I was looking for, thank you. I must have had a senior moment.

  6. #6
    2 Star Lounger
    Join Date
    Jun 2001
    Location
    Kenton, Delaware, USA
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Code Page Down (Access 2003)

    I love tabbed forms. I suspected there was a way to hide the tabs but don't know the technique. Can you enighten me? I have need for it on several of my apps to keep people out of trouble. Hiding or locking certain tabs has also been an interest of mine. Any tips you could pass along will be promptly stolen and displayed as my own work (haha).

    In this case though I wanted a different feel to the form. It is a survey and I only wanted one question at a time on the screen. what .

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Code Page Down (Access 2003)

    You can set the Visible property of a tab page to True or False as needed. you can refer to the tab page's name, or to the Pages collection of the tab control:

    Me.pagPage3.Visible = False

    or

    Me.tabSomething.Pages(2).Visible = False

    (Page numbering starts at 0 in the Pages collection, so Pages(2) is the 3rd page)

  8. #8
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Code Page Down (Access 2003)

    Each tab page in a tab control has a visible property that you can set using VBA. You will want to organize your tabs in a logical fashion, and then keep track in code as to which one is currently visible. It does require a fair bit of code, especially if you want to control the access to controls on a tab page, but it's a powerful technique that we often use with complex data input requirements where a wizard-like form is appropriate.
    Wendell

  9. #9
    4 Star Lounger SteveH's Avatar
    Join Date
    Jan 2001
    Location
    Chelsea, Gtr London, United Kingdom
    Posts
    587
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Code Page Down (Access 2003)

    <hr>I suspected there was a way to hide the tabs but don't know the technique. <hr>
    Set the Tab control's Style property to None (as opposed to Tabs or Buttons).

    I would have a Next and Back button which uses code like:
    Me.tabCtl.Pages(X).SetFocus
    where X is the page that you want to go to (starting at page 0))

    If you hide the tabs then you can control where your user goes through code. Tab pages do have an Enabled property which you can use.
    Steve H
    IT Lecturer/Access Developer
    O2K SR3/O2010; Win7Pro

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •