Results 1 to 13 of 13
  1. #1
    Jamesy_007 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Mar 2020
    Location
    Caribbean
    Posts
    109

    Tabs Control in Forms


    1. Hey guys, am building a database of persons where several things need to be tracked per person, I have a main form with a linked Master field and several sub-forms linked in child fields using Tabs. However Form in display looks really good with the firstpage or tab display but when I try to go to the other pages in tabs displayed in form view the Main Form becomes obscure out of view and user cannot see to enter data or make the pertinent link between main form and sub forms displayed in the related pages/Tabs. Why is this happening???; is it because some of the subforms/data sheet view is too large and therefore causing the main form that I want to be linked with the pages in Tabs to go out of for the user AND

    2. How to get rid of the excess white background in Tab page display want to go to each sub form and it adapts the exact size fit of each sub form/data sheet view to enter Data Could anyone guide me with this Please????

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    you should only use 1 subform on top of the tabs (not in) instead of 1 subform per tab.
    this way it save memory footprint so all you must do is swap out the source of the subform depending on the tab:

    Code:
    Private Sub TabCtl4_Change()
    Select Case TabCtl4.Value
      Case 0  '"Phones"
         subFrm.SourceObject = "frmPhones"
      Case 1  '"clients"
         subFrm.SourceObject = "frmClients"
      Case 2  '"Invoices"
         subFrm.SourceObject = "frmInvoices"
    End Select
    End Sub
    


    excess white space is there since different forms take up different widths.
    you could adjust the width , again depending on what tab gets clicked.

  3. #3
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,741
    you should only use 1 subform on top of the tabs (not in) instead of 1 subform per tab.
    this way it save memory footprint so all you must do is swap out the source of the subform depending on the tab:
    I've not seen that technique before. I believe it duplicates the problem of a navigation control that won't allow communication between subforms.

  4. #4
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    the Main Form becomes obscure out of view
    That has to be because one or more forms are not actually on a tab page. There's no way a page can be bigger than the control itself, and if it looks OK on the first page, the tab control must be a suitable size. So if things looks OK on page1 but not page3 you must not actually looking at page3 but something that you thought you dropped on it but didn't. Make sure the objects are on/in the pages and not lying on top of them (overlaid). If that's not it, then I've misunderstood the information.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #5
    Jamesy_007 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Mar 2020
    Location
    Caribbean
    Posts
    109
    [So if things looks OK on page1 but not page3 you must not actually looking at page3 but something that you thought you dropped on it but didn't.][/QUOTE] No you're correct u did understand

  6. #6
    Jamesy_007 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Mar 2020
    Location
    Caribbean
    Posts
    109
    So if things looks OK on page1 but not page3 you must not actually looking at page3 but something that you thought you dropped on it but didn't. yep you're right figured it out today don't know why I was getting that problem on home laptop but on work looks better

  7. #7
    Jamesy_007 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Mar 2020
    Location
    Caribbean
    Posts
    109
    Hey ranman256 thanks for the insight; am not a programmer jus a newbie with Love for Access could you explain what this code u wrote does on the on change()event for tab pages. Note I've been watching videos bought books and a couple of online courses so my leaning may not be systematic Trying to learn a lot all at once. i even wrote this code myself from watching videos and not sure what it does but i debug it and it seems good.


    Private Sub TabCtl96_Change()
    Select Case Me.TabCtl96.Value
    Case Me.[frmInmOff_Jun].SourceObject
    Me.[frmInmOff_Jun].Requery
    Case Me.[frmCourtDates].SourceObject
    Me.[frmCourtDates].Requery
    Case Me.[frmBailed].SourceObject
    Me.[frmBailed].Requery
    Case Me.[frmTransfJun].SourceObject
    Me.[frmTransfJun].Requery
    Case Me.frmConJun.SourceObject
    Me.[frmConJun].Requery
    End Select
    End Sub

  8. #8
    Jamesy_007 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Mar 2020
    Location
    Caribbean
    Posts
    109
    hey davegri I've also notice the record selector at the base of the main form when selecting records one-through, the main form records changes meaning to the linked MASTER and Childs Fields Great. But the combo box to the header of the form where names are searched when looking for persons records stays stationary to the last name that was pulled up. is their a code also for the user that if they are using the record selectors at the base of the form the name at find persons to the header of the form changes also???

  9. #9
    accesstos's Avatar
    accesstos is offline Expert
    Windows XP Access 2007
    Join Date
    Dec 2018
    Location
    Greece
    Posts
    551
    Quote Originally Posted by Jamesy_007 View Post
    Hey ranman256 thanks for the insight; am not a programmer jus a newbie with Love for Access could you explain what this code u wrote does on the on change()event for tab pages. Note I've been watching videos bought books and a couple of online courses so my leaning may not be systematic Trying to learn a lot all at once. i even wrote this code myself from watching videos and not sure what it does but i debug it and it seems good.


    Private Sub TabCtl96_Change()
    Select Case Me.TabCtl96.Value
    Case Me.[frmInmOff_Jun].SourceObject
    Me.[frmInmOff_Jun].Requery
    Case Me.[frmCourtDates].SourceObject
    Me.[frmCourtDates].Requery
    Case Me.[frmBailed].SourceObject
    Me.[frmBailed].Requery
    Case Me.[frmTransfJun].SourceObject
    Me.[frmTransfJun].Requery
    Case Me.frmConJun.SourceObject
    Me.[frmConJun].Requery
    End Select
    End Sub
    An other way:

    Give to each page the name of the corresponding subform. Then you can use this code bellow:
    Code:
    Private Sub TabCtl96_Change()
        With Me.TabCtl96
            Me.FormBody.SourceObject = .Pages(.Value).Name
        End With
    End Sub
    As you add pages (Subforms/SourceObjects etc) or make changes on the tab control, the code continue to works properly.

    Quote Originally Posted by Jamesy_007 View Post
    hey davegri I've also notice the record selector at the base of the main form when selecting records one-through, the main form records changes meaning to the linked MASTER and Childs Fields Great. But the combo box to the header of the form where names are searched when looking for persons records stays stationary to the last name that was pulled up. is their a code also for the user that if they are using the record selectors at the base of the form the name at find persons to the header of the form changes also???
    Code:
    Private Sub Form_Current()
        'Event of main form.
        Me.cboPersons = Me.PersonID
    End Sub
    Cheers,
    John

  10. #10
    Jamesy_007 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Mar 2020
    Location
    Caribbean
    Posts
    109
    Still dont understand what the code does on the Expression builder change() event??? could u try and explain?, the last code you showed i understand what it means and does but in the on change() event Tabs what feature or function i what to happen here
    Quote Originally Posted by accesstos View Post
    An other way:

    Give to each page the name of the corresponding subform. Then you can use this code bellow:
    Code:
    Private Sub TabCtl96_Change()
        With Me.TabCtl96
            Me.FormBody.SourceObject = .Pages(.Value).Name
        End With
    End Sub
    As you add pages (Subforms/SourceObjects etc) or make changes on the tab control, the code continue to works properly.



    Code:
    Private Sub Form_Current()
        'Event of main form.
        Me.cboPersons = Me.PersonID
    End Sub
    Cheers,
    John

  11. #11
    kd2017 is offline Well, I tried at least.
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    1,165
    Quote Originally Posted by ranman256 View Post
    you should only use 1 subform on top of the tabs (not in) instead of 1 subform per tab.
    this way it save memory footprint so all you must do is swap out the source of the subform depending on the tab:
    Quote Originally Posted by accesstos View Post
    An other way:

    Give to each page the name of the corresponding subform. Then you can use this code bellow:
    Code:
    Private Sub TabCtl96_Change()
        With Me.TabCtl96
            Me.FormBody.SourceObject = .Pages(.Value).Name
        End With
    End Sub
    As you add pages (Subforms/SourceObjects etc) or make changes on the tab control, the code continue to works properly.
    Learn something new everyday, I'm going to try to use this trick! Love it when "lurking" pays off.

  12. #12
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,741
    Quote Originally Posted by Jamesy_007 View Post
    hey davegri I've also notice the record selector at the base of the main form when selecting records one-through, the main form records changes meaning to the linked MASTER and Childs Fields Great. But the combo box to the header of the form where names are searched when looking for persons records stays stationary to the last name that was pulled up. is their a code also for the user that if they are using the record selectors at the base of the form the name at find persons to the header of the form changes also???
    I think you want to blank out the name in the search combobox when moving off the found record with the navigation buttons. Add this red code to the frmEnterOffense:

    Code:
    Option Compare Database
    Option Explicit
    
    
    Private Sub cboSearch_AfterUpdate()
        Dim strCriteria As String
        strCriteria = "[Person_PK] =" & Me.cboSearch
        Me.RecordsetClone.FindFirst (strCriteria)
        If Me.RecordsetClone.NoMatch Then
            MsgBox "Person not found"
        Else
            Me.Bookmark = Me.RecordsetClone.Bookmark
        End If
    End Sub
    
    
    Private Sub Form_Current()
        Me.cboSearch = ""
    End Sub

  13. #13
    accesstos's Avatar
    accesstos is offline Expert
    Windows XP Access 2007
    Join Date
    Dec 2018
    Location
    Greece
    Posts
    551
    Quote Originally Posted by Jamesy_007 View Post
    Still dont understand what the code does on the Expression builder change() event??? could u try and explain?, the last code you showed i understand what it means and does but in the on change() event Tabs what feature or function i what to happen here
    A tab control is a collection of pages, and, in this case, we can use it as an array of form names.
    Imagine the tab control as a table with three usefull fields: ID(.Value), Caption(page's label) and Name(page's hidden name).
    The expression ".Pages(.Value).Name" returns the name of the selected page like a query does on table above. For example:
    Code:
    SELECT [Caption], [Name] From [TabCtrl] WHERE ID=" & Me.TabCtrl.Value
    Page's label display the [Caption] and the subform display the form [Name].

    The subform doesn't need to be part of the Tab control.

    Inspect a sample database in attachment that use a tab control and a frame with toggle buttons, in collaboration, as horizontal and vertical navigation menus. Also, it provides several tips and tricks that I belive will inspire you.
    In Access, many things can be done with several ways, and this is an advantage, but, at the beginning, can produse confusion.
    Keep your thinking outside the box.

    Good luck with your project!
    John
    Attached Files Attached Files

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

Similar Threads

  1. Adding tabs to a tab control dynamically
    By S2000magician in forum Access
    Replies: 3
    Last Post: 07-11-2019, 12:53 PM
  2. Help!! with forms and tabs please.
    By fouraussiekids in forum Database Design
    Replies: 4
    Last Post: 09-06-2013, 02:22 AM
  3. Sub forms, tabs, and buttons
    By Kat-ness in forum Forms
    Replies: 2
    Last Post: 12-05-2012, 12:08 AM
  4. Forms displaying as tabs
    By Ted C in forum Forms
    Replies: 3
    Last Post: 08-09-2010, 02:55 PM
  5. Making tabs in forms
    By cesarone82 in forum Access
    Replies: 0
    Last Post: 06-09-2009, 12:47 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