Page 1 of 2 12 LastLast
Results 1 to 15 of 21
  1. #1
    LoriH is offline Novice
    Windows 10 Access 2007
    Join Date
    Apr 2020
    Posts
    17

    Access 2016 - Multi Tabbed Form - How do I create a button on one tab to link to the next tab?

    I have created a form in Microsoft Access v. 2016 that contains four tabs - but the fourth tab doesn't have enough room so I am going to split it in two. However, because they are the same, I want to put a button at the bottom of tab 4 which, when clicked, takes the user to the top of the second page (which is now tab 5 of the form).



    How do I do that? I know it can be done through VBA but my skills in VBA are nil, I just need to know the code in order to create the button. I can see how to use hyperlinks, but it only allows linking to different forms, not to tabs within the same form.

    Thank you for whatever help you can provide.

    Lori

  2. #2
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,818
    first, we're not talking about a navigation form with navigation tabs; this is a form with a tab control and each page has a form on it? If the latter, then you're saying you have split up form controls over 2 pages? I guess I'm not understanding the need for a button on a form that takes you to a new page when you could just click on that page at the top where the tab control page tabs are.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    LoriH is offline Novice
    Windows 10 Access 2007
    Join Date
    Apr 2020
    Posts
    17
    Hi there - thanks for your response. Yes, it's a form with navigation tabs at the top. And yes, the user could just click on the next tab, but they'll need to scroll up to the top and it's a long form. It's not really a need, it's a want. It will make it easier for the user to simply click a button and be taken to the top of the second page (or tab). I know how to create the button, I just don't know the VBA code that will do what I want it to do. Or maybe I could create a macro that will take the user to the top of the next tab?

  4. #4
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,818
    Yes, it's a form with navigation tabs at the top
    Sorry, that doesn't clear it up for me. There is such a thing as a navigation form & it has tabs. A tab control has pages, but people call them "tabs" all the time (and why not - M$ named it a tab control, not a page control). It causes a lot of confusion because they are not the same thing.
    If it is a form with a tab control then this doesn't make sense
    And yes, the user could just click on the next tab, but they'll need to scroll up to the top
    because such a form would not need scroll bars. I have a feeling this is a navigation form. Maybe you could post a pic of the design view?

  5. #5
    LoriH is offline Novice
    Windows 10 Access 2007
    Join Date
    Apr 2020
    Posts
    17
    Hi there - my apologies, I have taught myself what little I know and really don't know the lingo.

    Here is an image of what I'm trying to do. At the bottom of "Page 4", I want a button that takes the user to the top of "Page 4 Continued".
    Click image for larger version. 

Name:	Sample Form.JPG 
Views:	26 
Size:	14.8 KB 
ID:	41649
    Attached Thumbnails Attached Thumbnails Sample Form.JPG  

  6. #6
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,818
    OK, it looks like a tab control. I probably could have just asked you to report what the property sheet Selection Type said when you select the control itself. It says "Tab Control" if that's the case. As I mentioned, I don't get the problem, really. Why would you not automatically be at the top of a form when you switch pages?
    What type of form have you "split up"? I'm having trouble picturing that or what it means to "split up" a form. I have divided controls up into pages because each page was related to the main form, but you seem to want to do something else.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  7. #7
    LoriH is offline Novice
    Windows 10 Access 2007
    Join Date
    Apr 2020
    Posts
    17
    We have forms that are required to be completed for each of our clients. These forms were previously completed in Word and saved to our document management. But we need to be able to keep track the information contained in each of those forms, so I'm setting up those forms in Access so that the information will be in one place, in a database, so I can use queries to search for certain information. There are four forms, one for each type of situation. However, the fourth form is very long, it is four pages in Word and when printed on 8.5 x 11 pages. I was able to fit three of the pages onto one Tab in Access, but the page just isn't long enough to allow me to add the rest. So I created a fifth tab, as you see in the image I sent you (I created that as a sample but it looks the same). I have split that last form (as it was called when saved in Word) in half, putting the first half on "Page 4", and the rest on "Page 4 Continued". When someone is filling out the form and gets to the bottom of "Page 4", I want to put a link or button that allows them to jump to the next tab, or "Page 4 Continued" so they can continue to add their information. Is that clearer?

  8. #8
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,818
    Sort of. I have experience with document management system in Access but it doesn't sound like this one. Would you not think that in your db you could simply call up the completed form and look at it? Sorry for the continual questions, but sometimes we end up finding a better solution that way. Sometimes it's not possible to even begin answering the question without understanding some things about the db.

    I still don't know what "split up" means with respect to a document. AFAIK, a Word document is one file. That you could split one file into 2 parts in the db is news to me, so I guess I have to fall back on what I've alluded to before. Even if you have a button at the bottom of page 4 to activate any other page, I still can't imagine why you would not be at the top of the form. If you're asking when you haven't built anything yet, then all I can suggest is that you try it. If you're looking for help with code to activate a tab control page, I should be able to help with that.

    I'm curious to know how you work with Word documents in an Access db, unless it's by way of using Access vba to load Word form fields into tables. Our dms just kept all the relevant data (relevant ISO clause, doc#, last review date, reviewer, etc. ) and served up the document when needed. However, I guess you have more pressing needs right now so don't worry about my puzzlement.

  9. #9
    LoriH is offline Novice
    Windows 10 Access 2007
    Join Date
    Apr 2020
    Posts
    17
    I'm not working with Word documents, I have recreated the forms from scratch in MS Access. I only mentioned about Word so you would understand what I'm trying to do. But it's okay, I'll figure it out. I do really appreciate your time and effort in understanding my clumsy request.

  10. #10
    accesstos's Avatar
    accesstos is offline Expert
    Windows XP Access 2007
    Join Date
    Dec 2018
    Location
    Greece
    Posts
    551
    Hi Lori!

    Add a button on page 4 as you want and right-click on it.
    In pop up menu, choose "Build Event..."
    In the VBEditor, you will see something like that:
    Code:
    Private Sub Command1_Click()
    
    End Sub
    Command1 is the name of the button. In your case will appear the actual name of your button.

    Between the lines "Private Sub..." and "End Sub", add those two lines of code:
    Code:
        Me.TabCtrl.Value = Me.TabCtrl.Value + 1
        Me.GoToPage 1
    Replace the TabCtrl with the actual name of your tab control.
    Return to your form, open it in "Form View" and click the button.

    I hope this works as you expect.

    Of course, always you can go to the first control of the next page hitting Ctrl+Tab on keyboard.

    Cheers,
    John

  11. #11
    LoriH is offline Novice
    Windows 10 Access 2007
    Join Date
    Apr 2020
    Posts
    17
    Hi John, thank you so much for this!

    I've obviously done something wrong though because it's giving me an error. Can you help? The buttton has the name I want though. Click image for larger version. 

Name:	Error re vb button.JPG 
Views:	23 
Size:	25.9 KB 
ID:	41660

    The Tab Control is called Organization Verification P2.

    Thank you!

    Lori

  12. #12
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,818
    And the error is?
    You shouldn't need value on either side of the equation, but that may be irrelevant. This works for me

    Me.TabCtl5 = Me.TabCtl5 + 1

    Also, the way you've coded it, regardless of which button you click in the message box it's going to swap pages anyway. You shouldn't need GoTo either.
    One thing at a time, I guess.

  13. #13
    Join Date
    Apr 2017
    Posts
    1,687
    On both tabs (e.g. pgPage4_1 and pgPage4_2)you have subforms (e.g. sfForm4_1 and sfForm4_2). Those subforms have forms (e.g. fForm4_1 and fForm4_2) as source. Both fForm4_1 and fForm4_2 have same table/query (e.g. tblTable4) as source. Both forms have invisible control with PK of tlbTable4 as source, and a set of different controls based on other fields of tblTable4.

    For both fForm4_1 and fForm_4_2 you create a Current event, which synchronizes both forms in according subforms (i.e. both subforms always display same record). Whenever you select another record in one subform and then activate another one, the same record is visible and activated there.

    I myself have used a design like this when source table has many fields and/or there are big text fields, where one continuous non-editable subform with limited set of controls is used as lookup form, and another single subform is used to edit/add/delete [current] record, but same design may be used to split a big form too. The main concern for you is to avoid an infinite loop.

  14. #14
    accesstos's Avatar
    accesstos is offline Expert
    Windows XP Access 2007
    Join Date
    Dec 2018
    Location
    Greece
    Posts
    551
    Hi all!

    Lori, you are welcome!

    Please let us know about the error that you get.

    To manipulate the Cancel of the user, the code has to be as follows:
    Code:
    If MsgBox("Continue on Page 2", vbOKCancel) = vbOK Then
        Me.Organization_Verification_P2.Value = Me.Organization_Verification_P2.Value + 1
        Me.GoToPage 1
    End If
    Also, try to use short names for the Access objects without blank spaces, like "tabOVP2" or "tabOrgVerP2". It's always a good practice.

    Cheers,
    John

  15. #15
    LoriH is offline Novice
    Windows 10 Access 2007
    Join Date
    Apr 2020
    Posts
    17
    Hi John.

    I think I have met my match - I just cannot get this to go. I changed the code to match what you have and get the attached error.Click image for larger version. 

Name:	Error re vb.JPG 
Views:	14 
Size:	77.5 KB 
ID:	41666

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 08-29-2019, 01:04 AM
  2. Replies: 4
    Last Post: 08-07-2018, 05:38 AM
  3. Replies: 6
    Last Post: 01-01-2018, 10:41 AM
  4. Replies: 3
    Last Post: 03-17-2017, 08:00 AM
  5. Create an RDP link button on my form
    By BDP in forum Access
    Replies: 1
    Last Post: 09-14-2010, 02:49 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