Tab Control Help Wanted

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bob Dydd

    Tab Control Help Wanted

    Hi Everybody

    I have a form with a 5 page Tab contol.

    When I open the form, I would like it to be on the page I last looked
    at when I previously open the form.

    Regard and Thanks in advance

    Smiley Bob
  • John Baker

    #2
    Re: Tab Control Help Wanted

    Bob Dydd wrote:[color=blue]
    > I have a form with a 5 page Tab contol.
    >
    > When I open the form, I would like it to be on the page I last looked
    > at when I previously open the form.[/color]

    There are probably a ton of ways to do this, but this is what I would do:

    Forms have a Tag property whose only functionality is to store any extra
    information you want about the form. On the OnClose event of the
    form, store the name of the Page that has the focus in this property,
    and on the OnOpen event retrieve it and set the focus to that page.

    Comment

    • Allen Browne

      #3
      Re: Tab Control Help Wanted

      Take a look at this article:
      Return to the same record next time form is opened
      at:


      It explains how to return to the same record next time the form opens. You
      could use the same approach to store the Value of the tab control in a
      table, and then set the value again in the Load event of the form.

      --
      Allen Browne - Microsoft MVP. Perth, Western Australia.
      Tips for Access users - http://allenbrowne.com/tips.html
      Reply to group, rather than allenbrowne at mvps dot org.

      "John Baker" <baker-j@ix.netcom.com > wrote in message
      news:Mkz8d.1592 $K46.468@fe1.co lumbus.rr.com.. .[color=blue]
      > Bob Dydd wrote:[color=green]
      >> I have a form with a 5 page Tab contol.
      >>
      >> When I open the form, I would like it to be on the page I last looked
      >> at when I previously open the form.[/color]
      >
      > There are probably a ton of ways to do this, but this is what I would do:
      >
      > Forms have a Tag property whose only functionality is to store any extra
      > information you want about the form. On the OnClose event of the form,
      > store the name of the Page that has the focus in this property, and on the
      > OnOpen event retrieve it and set the focus to that page.[/color]


      Comment

      • Dirk Goldgar

        #4
        Re: Tab Control Help Wanted

        "Bob Dydd" <reallyuseful20 04@yahoo.co.uk> wrote in message
        news:255d35ad.0 410050747.3a445 a68@posting.goo gle.com[color=blue]
        > Hi Everybody
        >
        > I have a form with a 5 page Tab contol.
        >
        > When I open the form, I would like it to be on the page I last looked
        > at when I previously open the form.
        >
        > Regard and Thanks in advance
        >
        > Smiley Bob[/color]

        Then you're going to have to store that information somewhere. You
        could have a table to store such configuration information, read from it
        in the form's Open or Load event, and update it in the form's Unload or
        Close event -- or you could create and use a private property of the
        form. That last requires a bit more code -- let me know if you want to
        go that way.

        The page of the tab control that is currently displayed is available
        (read/write) as the Value of the tab control itself. This value is
        equal to the PageIndex property of the displayed page.

        --
        Dirk Goldgar, MS Access MVP


        (please reply to the newsgroup)


        Comment

        • Bob Dydd

          #5
          Re: Tab Control Help Wanted

          John Baker <baker-j@ix.netcom.com > wrote in message news:<Mkz8d.159 2$K46.468@fe1.c olumbus.rr.com> ...[color=blue]
          > Bob Dydd wrote:[color=green]
          > > I have a form with a 5 page Tab contol.
          > >
          > > When I open the form, I would like it to be on the page I last looked
          > > at when I previously open the form.[/color]
          >
          > There are probably a ton of ways to do this, but this is what I would do:
          >
          > Forms have a Tag property whose only functionality is to store any extra
          > information you want about the form. On the OnClose event of the
          > form, store the name of the Page that has the focus in this property,
          > and on the OnOpen event retrieve it and set the focus to that page.[/color]

          Hmm. Thanks for the answers people.

          I don't want to use another table to store the info so, the tag
          function looks most appropiate for what I'm trying to do. Problem is I
          have never seen it used in any mdb before.

          I have started to write the following "air code" for the form

          Private Sub CmdExit_Click()
          Forms!frmTransa ctionTaskList.t ag = "TabCtlPages.Va lue = PageSold"
          DoCmd.Close
          End Sub
          ' This is to receive info on whatever the last page was I was looking
          at

          Private Sub Form_Open(Cance l As Integer)
          ' Some code to retrieve the code from the Tag and set the
          ' focus to the last page I was looking at.
          End Sub

          BTW what needs to go in Form>Properties > Tag

          Thanks for giving this your attention.

          Smiley Bob

          Comment

          • Arno R

            #6
            Re: Tab Control Help Wanted

            > I don't want to use another table to store the info so, the tag[color=blue]
            > function looks most appropiate for what I'm trying to do. Problem is I[/color]

            If you distribute an mde to your users they won't be able to store the tag property...
            The table approach however can always be used.
            I always use a local table for local user-settings


            Arno R



            Comment

            • Rick Brandt

              #7
              Re: Tab Control Help Wanted

              "Bob Dydd" <reallyuseful20 04@yahoo.co.uk> wrote in message
              news:255d35ad.0 410060136.725ec 72b@posting.goo gle.com...[color=blue]
              > John Baker <baker-j@ix.netcom.com > wrote in message[/color]
              news:<Mkz8d.159 2$K46.468@fe1.c olumbus.rr.com> ...[color=blue][color=green]
              > > Bob Dydd wrote:[color=darkred]
              > > > I have a form with a 5 page Tab contol.
              > > >
              > > > When I open the form, I would like it to be on the page I last looked
              > > > at when I previously open the form.[/color]
              > >
              > > There are probably a ton of ways to do this, but this is what I would[/color][/color]
              do:[color=blue][color=green]
              > >
              > > Forms have a Tag property whose only functionality is to store any[/color][/color]
              extra[color=blue][color=green]
              > > information you want about the form. On the OnClose event of the
              > > form, store the name of the Page that has the focus in this property,
              > > and on the OnOpen event retrieve it and set the focus to that page.[/color]
              >
              > Hmm. Thanks for the answers people.
              >
              > I don't want to use another table to store the info so, the tag
              > function looks most appropiate for what I'm trying to do. Problem is I
              > have never seen it used in any mdb before.[/color]

              You actually can't use the Tag property because making a change that would
              persist between uses of the form would require that you open the form in
              design view to set the property. Setting it while in normal view would
              only persist until the form was closed.

              Use a table. The exact purpose of a table is to store data that needs to
              persist. This is what databases use for storage so I fail to see why you
              wouldn't want to use one. Many apps have tables that are used for odds and
              ends such as this.


              --
              I don't check the Email account attached
              to this message. Send instead to...
              RBrandt at Hunter dot com


              Comment

              • Bob Dydd

                #8
                Re: Tab Control Help Wanted

                "Dirk Goldgar" <dg@NOdataSPAMg nostics.com> wrote in message news:<u##XKVvqE HA.3428@TK2MSFT NGP11.phx.gbl>. ..[color=blue]
                > "Bob Dydd" <reallyuseful20 04@yahoo.co.uk> wrote in message
                > news:255d35ad.0 410050747.3a445 a68@posting.goo gle.com[/color]
                [color=blue]
                > Then you're going to have to store that information somewhere. You
                > could have a table to store such configuration information, read from it
                > in the form's Open or Load event, and update it in the form's Unload or
                > Close event -- or you could create and use a private property of the
                > form. That last requires a bit more code -- let me know if you want to
                > go that way.
                >
                > The page of the tab control that is currently displayed is available
                > (read/write) as the Value of the tab control itself. This value is
                > equal to the PageIndex property of the displayed page.[/color]

                Hi All

                Well, I Tried Tag properties but the property was not available once
                the form had closed.

                So, back to the drawing board. I guess it is going to have to be a
                table (or maybe temp Table), to store the last used focus page.

                This can then be retrieved by the open or load event, dunno which.

                Any pointers to the industry standard way of doing this would be most
                welcome.
                Regards All Smiley Bob

                Comment

                • John Baker

                  #9
                  Re: Tab Control Help Wanted

                  Bob Dydd wrote:[color=blue]
                  > Well, I Tried Tag properties but the property was not available once
                  > the form had closed.[/color]

                  Sorry I led you down the wrong path. I could have sworn that I had used
                  that method for something similar once, but I must have been wrong.

                  Comment

                  • Dirk Goldgar

                    #10
                    Re: Tab Control Help Wanted

                    "Bob Dydd" <reallyuseful20 04@yahoo.co.uk> wrote in message
                    news:255d35ad.0 410060738.3e84e 2d4@posting.goo gle.com[color=blue]
                    >
                    > Hi All
                    >
                    > Well, I Tried Tag properties but the property was not available once
                    > the form had closed.
                    >
                    > So, back to the drawing board. I guess it is going to have to be a
                    > table (or maybe temp Table), to store the last used focus page.
                    >
                    > This can then be retrieved by the open or load event, dunno which.
                    >
                    > Any pointers to the industry standard way of doing this would be most
                    > welcome.
                    > Regards All Smiley Bob[/color]

                    I don't know about the "industry standard", but as Rick Brandt said,
                    lots of applications have little tables of configuration info. Do you
                    have any specific questions about how to implement this?

                    --
                    Dirk Goldgar, MS Access MVP


                    (please reply to the newsgroup)


                    Comment

                    • Bob Dydd

                      #11
                      Re: Tab Control Help Wanted

                      "Dirk Goldgar" <dg@NOdataSPAMg nostics.com> wrote in message news:<OGZ3KE8qE HA.516@TK2MSFTN GP09.phx.gbl>.. .
                      [color=blue]
                      > I don't know about the "industry standard", but as Rick Brandt said,
                      > lots of applications have little tables of configuration info. Do you
                      > have any specific questions about how to implement this?[/color]

                      Thanks for your attention to my problem.

                      I was definately barking up the wrong tree with tag properties.

                      I took on board what you and others said about a table, and did it that way.

                      I learned a lot using Allen Browne's code, and with some juggling I made that work.

                      Once again thanks people.

                      Smiley Bob

                      Comment

                      • Allen Browne

                        #12
                        Re: Tab Control Help Wanted

                        Well done, Bob. :-)

                        --
                        Allen Browne - Microsoft MVP. Perth, Western Australia.
                        Tips for Access users - http://allenbrowne.com/tips.html
                        Reply to group, rather than allenbrowne at mvps dot org.

                        "Bob Dydd" <reallyuseful20 04@yahoo.co.uk> wrote in message
                        news:255d35ad.0 410061617.59fef 47@posting.goog le.com...[color=blue]
                        >
                        > I took on board what you and others said about a table, and did it that
                        > way.
                        >
                        > I learned a lot using Allen Browne's code, and with some juggling I made
                        > that work.
                        >
                        > Once again thanks people.
                        >
                        > Smiley Bob[/color]


                        Comment

                        Working...