Subform (tabbed page) visible on main form ONLY if subform has data

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mminieri
    New Member
    • Jun 2018
    • 32

    Subform (tabbed page) visible on main form ONLY if subform has data

    My main form has many tabbed subform pages, and a button for NEW record and one for EXISTING record. A user can access a specific existing record from a dropdown combobox that opens from that command button. Selecting a record returns to the MAIN form and populates all fields including those on all subforms. The subform tabs are NOT VISIBLE when the main form is originally loaded. After the selected existing record loads and the main form reopens, I want ALL of those subforms (tabs) that have data in any field to become visible (i.e. available for selection using its tab) on the main form, when it reopens. Remember that none of the subforms will be the CURRENT form so I cannot use the ME/ME! function. Essentially, I need a correct VBA code along the following lines;

    IF subform is not null, then subform visible = true


    I seem to be having difficulty referencing a subform that is not open/current ... twice. My subform and its controltab have the same name.

    I will write the correct code for each subform specifically. My current thought is to put these as an AfterUpdate event in the code behind the action that occurs when the selection is made buy the user from the combobox.
  • Nauticalgent
    New Member
    • Oct 2015
    • 103

    #2
    Give this a look over:

    Comment

    • twinnyfo
      Recognized Expert Moderator Specialist
      • Nov 2011
      • 3655

      #3
      mminieri,

      Welcome to Bytes!

      For clarification purposes:
      My main form has many tabbed subform pages
      I'm not sure what this means. Do you have:
      • Many "Sub-Forms"?
      • One Sub-Form with a Tab Control that has many pages?
      • One Tab Control that has Sub-Forms on each page?

      Please clarify, as that will help us best provide guidance toward a solution.

      Thanks!
      Last edited by twinnyfo; Jun 27 '18, 04:08 PM. Reason: changes "tabs" to "pages"

      Comment

      • mminieri
        New Member
        • Jun 2018
        • 32

        #4
        TWINNYFO

        [IMG]ftp://minieriassociat es.com/public_ftp/Mainform_tabsvi ew.jpg[/IMG]

        Posted an image (LINKED above) to view. There are only data fields under each tab.

        Originally posted by twinnyfo
        mminieri,

        Welcome to Bytes!

        For clarification purposes:

        I'm not sure what this means. Do you have:
        • Many "Sub-Forms"?
        • One Sub-Form with a Tab Control that has many tabs?
        • One Tab Control that has Sub-Forms on each tab?

        Please clarify, as that will help us best provide guidance toward a solution.

        Thanks!

        Comment

        • mminieri
          New Member
          • Jun 2018
          • 32

          #5
          NAUTICALGENT - The linked issue pertains to opening a subform by pressing the TAB. My post is without opening a subform at all .... only making it visible if it is not null.

          Comment

          • twinnyfo
            Recognized Expert Moderator Specialist
            • Nov 2011
            • 3655

            #6
            We cannot see your image. Many folks cannot access linked images from their work computers. You must upload it under the advances tab.

            Comment

            • NeoPa
              Recognized Expert Moderator MVP
              • Oct 2006
              • 32645

              #7
              Hi M.

              I hope and suspect that Referring to Items on a Sub-Form will give you the help you need for this one. Let us know if that doesn't do it for you.

              Comment

              • NeoPa
                Recognized Expert Moderator MVP
                • Oct 2006
                • 32645

                #8
                By the way, it's the Page that houses the SubForm that you want to show and hide. Not the SubForm itself.

                NB. Page is the correct name for the tabs on a Tab Control for anyone that doesn't realise.
                Last edited by NeoPa; Jun 27 '18, 01:35 PM.

                Comment

                • mminieri
                  New Member
                  • Jun 2018
                  • 32

                  #9
                  Mainform_image

                  ftp://minieriassociates.com/public_f...m_tabsview.jpg

                  [IMG]ftp://minieriassociat es.com/public_ftp/Mainform_tabsvi ew.jpg[/IMG]

                  Sorry but the "ATTACHMENT S" function is not working for me.

                  Comment

                  • twinnyfo
                    Recognized Expert Moderator Specialist
                    • Nov 2011
                    • 3655

                    #10
                    I still can't see the images. If you answer the questions in #3, I can probably assist a bit better (and so could others).

                    Comment

                    • NeoPa
                      Recognized Expert Moderator MVP
                      • Oct 2006
                      • 32645

                      #11
                      Hi MMinieri.

                      You've given an FTP link but it's secured with a name and password so no-one will be able to view it.

                      The attachments feature is working fine. If you're having difficulty with it and want some assistance please feel free to PM me with your issues and I'll endeavour to explain very clearly how to use it.

                      In the meantime, please revisit post #3 and answer each point directly.

                      Also let us know if the article I linked to in post #7 has resolved the issue for you. If not then perhaps you could explain why.

                      Comment

                      • mminieri
                        New Member
                        • Jun 2018
                        • 32

                        #12
                        Here are 2 accessible screen captures;

                        MAIN PAGE (default on load) shows TABCONTROLS
                        [IMGNOTHUMB]http://www.minieriasso ciates.com/Main.jpg[/IMGNOTHUMB]
                        Example TABBEDPAGE opened;
                        [IMGNOTHUMB]http://www.minieriasso ciates.com/TabPage.jpg[/IMGNOTHUMB]
                        for the later, property sheet uses the term "page".

                        This is the FORMVIEW at OnLoad
                        Last edited by mminieri; Jun 28 '18, 07:06 PM. Reason: added pic

                        Comment

                        • mminieri
                          New Member
                          • Jun 2018
                          • 32

                          #13
                          NeoPa - thanks. The link you provided does help understand the syntax for referencing the components at issue however, it does not provide a sample VBA for my desired functionality as in the original post. Faster for me to place the 2 images online then deal with the Attachment issue.

                          Comment

                          • mminieri
                            New Member
                            • Jun 2018
                            • 32

                            #14
                            Did not work entirely. The isnull element not working. Makes visible even if no data on that page.


                            I THINK I'VE SOLVED IT ..... will repost if no. I used,
                            Code:
                            If (IsNull(SUP1) = True) Then
                            SUP1.Visible = False
                            Else
                            SUP1.Visible = True
                            End If
                            End Sub
                            Last edited by NeoPa; Jun 28 '18, 09:09 AM. Reason: Added the mandatory [CODE] tags.

                            Comment

                            • NeoPa
                              Recognized Expert Moderator MVP
                              • Oct 2006
                              • 32645

                              #15
                              Instead of all that you could just say :
                              Code:
                              SUP1.Visible = (Not IsNull(SUP1))

                              Comment

                              Working...