Control Tab Possibllities

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • csolomon
    New Member
    • Mar 2008
    • 166

    #16
    I don't get it Chip.

    I put an unbound combo box, combo10, on the form with the MatTypeIDs. In the after event update I have this:

    Code:
    Select Case matTypeID
    
       Case Is = 1
    TabCtl1.Pages(1).Visible = False
    TabCtl1.Pages(2).Visible = False
    TabCtl1.Pages(3).Visible = False
    TabCtl1.Pages(4).Visible = False
    
       Case Is = 2
    TabCtl1.Pages(0).Visible = False
    TabCtl1.Pages(2).Visible = False
    TabCtl1.Pages(3).Visible = False
    TabCtl1.Pages(4).Visible = False
    
       Case Is = 3
    TabCtl1.Pages(1).Visible = False
    TabCtl1.Pages(0).Visible = False
    TabCtl1.Pages(3).Visible = False
    TabCtl1.Pages(4).Visible = False
    
       Case Is = 4
    TabCtl1.Pages(1).Visible = False
    TabCtl1.Pages(2).Visible = False
    TabCtl1.Pages(0).Visible = False
    TabCtl1.Pages(4).Visible = False
    
       Case Is = 5
    [B]TabCtl1.Pages(1).Visible = False[/B]
    TabCtl1.Pages(2).Visible = False
    TabCtl1.Pages(3).Visible = False
    TabCtl1.Pages(0).Visible = False
          
       Case Else
    MsgBox "Unexpected Case"
    End Select
    No matter what selection I make from the combo, it always says object required, error424. It points to the bold line in case Is =5

    Originally posted by ChipR
    Think about what is determining which tab you should show (ignore for the moment what is on the tabs), and select case on that. It seems like the user should select a category from a combo box, and the afterUpdate of the combo box should have a select case on the value chosen to show/hide the tabs.

    Also, in the Select Case, mine didn't work unless I used the syntax:

    Case Is = 1
    Case Is = 2
    etc.

    Comment

    • ChipR
      Recognized Expert Top Contributor
      • Jul 2008
      • 1289

      #17
      That's because you're selecting case on matTypeID and not combo10.

      Comment

      • OldBirdman
        Contributor
        • Mar 2007
        • 675

        #18
        I think you need to STOP!

        You are trying to code a problem that has not been clearly defined, and the rules seem to change with each post.

        The first thing is table design.
        I have 5 categories of material types.
        Is this a separate table?

        each material to be input by material type separately, which is currently not how I have it set up. currently, you select the matType and material in the same form, for all material types.
        Within each category is a material type, then a material. 2 tables?

        Second is the main form. At first glance, this is a typical cascading combobox design.
        I came up with the idea to use the tabs. I had an unbound text box at the top of the tab to have the user select the matType.
        This does not seem to be a tab problem, unless there is something not disclosed in the problem. Using an unbound textbox to select the tab (by typing the tab name into the textbox) isn't the way tabs should be used. Hiding the unused tabs then doesn't even allow the user to see their choices when entering into the textbox. Note: The code in Post #8 will hide ALL TABS after 2 calls to the subroutine.

        But there are many forms here. What is the difference, and why multiple forms. How do they relate to the tabs.
        So the text box's default value already represents the matTYpeID. The user does not have to input.
        Huh? If 5 types, it should be right 1/5 of the time. Or is it bound to a table.

        I want to know the table structures, and the controls on the form that control the data to be displayed. Whether the data display is on the main form, 5 additional forms, on subforms, or in the tab control is not important yet.

        Comment

        • csolomon
          New Member
          • Mar 2008
          • 166

          #19
          Code:
          You are trying to code a problem that has not been clearly defined, and the rules seem to change with each post.
          How do the rules change w/ each post? IMO, Chip has been giving me info about what works and what doesn't, in addition to assisting me with figuring out what is wrong...althoug h we haven't got there yet.

          Code:
          Note: The code in Post #8 will hide ALL TABS after 2 calls to the subroutine.
          This explains why only one tab shows up!

          Code:
            Within each category is a material type, then a material.  2 tables?
          Yes, two tables One material type will have many materials

          tblMatType
          matTypeID
          matType

          tblMaterials
          materialID
          matTypeID
          material

          tblMixDesign: (One Mixdesign will have many materials and material types in the MixSample, which are all the ingredients which make up a sample of concrete)
          DM_Mix
          DM_SampleNo
          DM_Date
          jobNumber

          tblMixSample
          DM_MaterialNo
          DM_Mix
          materialID
          matTypeID
          matBatchWeight
          pigPercent

          Code:
          I want to know the table structures, and the controls on the form that control the data to be displayed.  Whether the data display is on the main form, 5 additional forms, on subforms, or in the tab control is not important
          I have a main form, F_Test2_MixDesi gn
          I have a tabControl, tabCtl1 that has 5 tabs that represent each category of material type. Each tab has a subform that represents one of the 5 categories.
          subform 1, SF_CementType. subform 2, SF_CoarseType, subform3, SF_Fine, etc for Pigments and Chemicals (4 and 5).

          Here are the controls on the form for the data to be displayed:
          MaterialID - combo box
          matBatchWeight, txt box
          matGrav: txtbox
          matPRice: txtbox
          calculated fields: text boxes
          unbound combo box, representing the matTypeID that I would like my tabs driven by
          The controls used to display them are bound to the table(s).
          Code:
          But there are many forms here.  What is the difference, and why multiple forms.  How do they relate to the tabs.    Huh?  If 5 types, it should be right 1/5 of the time.  Or is it bound to a table.
          My ultimate goal is to have the user input the materials and information related to it, specifically in areas for each material type. The difference in the forms is that the record source differs by material Type. I tried to do it using just one form but it didn't work, so I thought I needed a subform that represents each matType

          Here is the record source:
          Code:
          SELECT MixSample.DM_Mix, MixSample.DM_MaterialNo, MixSample.matTypeID, MixSample.materialID, MixSample.matBatchWeight, MatType.matType, Material.material, Material.materialGrav, GetYield([MixSample].[matTypeID],[matBatchWeight],[Material].[materialGrav]) AS DMYield, MixSample.pigPercent, DLookUp("matPrice","MatPrices","materialID = " & [MixSample].[materialID] & " AND matPriceActive = True") AS _matPrice, GetMixCost([MixSample].[matTypeID],[matBatchWeight],[_matPrice]) AS DMMixCost FROM Material INNER JOIN (MixSample INNER JOIN MatType ON MixSample.matTypeID=MatType.matTypeID) ON Material.materialID=MixSample.materialID WHERE (((MixSample.DM_Mix)=Forms!F_Test2_MixDesign!DM_Mix) And ((MixSample.matTypeID)=Forms!F_Test2_MixDesign!SF_CementType.Form!Combo10));
          Code:
          Using an unbound textbox to select the tab (by typing the tab name into the textbox) isn't the way tabs should be used.
          I meant unbound combo box, not text box

          Originally posted by OldBirdman
          I think you need to STOP!

          You are trying to code a problem that has not been clearly defined, and the rules seem to change with each post.

          The first thing is table design. Is this a separate table?

          Within each category is a material type, then a material. 2 tables?

          Second is the main form. At first glance, this is a typical cascading combobox design.
          This does not seem to be a tab problem, unless there is something not disclosed in the problem. Using an unbound textbox to select the tab (by typing the tab name into the textbox) isn't the way tabs should be used. Hiding the unused tabs then doesn't even allow the user to see their choices when entering into the textbox. Note: The code in Post #8 will hide ALL TABS after 2 calls to the subroutine.

          But there are many forms here. What is the difference, and why multiple forms. How do they relate to the tabs. Huh? If 5 types, it should be right 1/5 of the time. Or is it bound to a table.

          I want to know the table structures, and the controls on the form that control the data to be displayed. Whether the data display is on the main form, 5 additional forms, on subforms, or in the tab control is not important yet.

          Comment

          • ChipR
            Recognized Expert Top Contributor
            • Jul 2008
            • 1289

            #20
            Why did you change your record source to include the combo value? The record source for each subform should not change. You are only changing which one is visible.

            You can show the appropriate subform either by stacking all the subforms on each other and show/hiding them, or by putting them on the tabs and showing the appropriate tab. This is controlled by the combo box the user can make a selection from.

            This is actually much simpler than you think, but I don't really know how to explain it any differently.

            Edit: combo box is bound to category types, not unbound

            Comment

            • csolomon
              New Member
              • Mar 2008
              • 166

              #21
              I am absolutely sure this isn't difficult, I was am just having issues.
              OK. I chose the method of using a subform on each tab.

              My control sources for each subform are the same. It does not include the combo value
              The combox controlling the tabs is bound to matTypeID

              Originally posted by ChipR
              Why did you change your record source to include the combo value? The record source for each subform should not change. You are only changing which one is visible.

              You can show the appropriate subform either by stacking all the subforms on each other and show/hiding them, or by putting them on the tabs and showing the appropriate tab. This is controlled by the combo box the user can make a selection from.

              This is actually much simpler than you think, but I don't really know how to explain it any differently.

              Edit: combo box is bound to category types, not unbound
              Last edited by csolomon; Mar 26 '09, 02:56 PM. Reason: It still isn't functioning like it should. I am going to try to stack the forms.

              Comment

              • ChipR
                Recognized Expert Top Contributor
                • Jul 2008
                • 1289

                #22
                Ok. Your record source in your previous post had Combo10 in it, so I'm assuming you fixed that. Your control sources for each subform should not be the same. What would be the point of having 5? There should be one subform for each category, and each has it's control source showing records of that category. You don't change the subforms' data, you change which is visible.

                You should have code in the after update event of the combo box controlling the tabs and select case on the value of the combo box.

                Comment

                • csolomon
                  New Member
                  • Mar 2008
                  • 166

                  #23
                  Chip, I misunderstood this part:
                  Code:
                  Why did you change your record source to include the combo value? The record source for each subform should not change
                  So I changed it from what it was (each subform source had the appropriate matTypeid it represented).

                  Here is what is in the after event of the combo box:

                  Code:
                  Private Sub matTypeID_AfterUpdate()
                  Select Case matTypeID
                     Case 1
                        Me.materialID.Requery
                  TabCtl1.Pages(1).Visible = False
                  ' TabCtl1.Pages(2).Visible = False
                  ' TabCtl1.Pages(3).Visible = False
                  ' TabCtl1.Pages(4).Visible = False
                  TabCtl1.Pages(0).Visible = True
                     Case 2
                        Me.materialID.Requery
                  TabCtl1.Pages(1).Visible = True
                  ' TabCtl1.Pages(2).Visible = False
                  ' TabCtl1.Pages(3).Visible = False
                  ' TabCtl1.Pages(4).Visible = False
                  TabCtl1.Pages(0).Visible = False
                     'Case 3
                      '  Me.materialID.Requery
                     'Case 4
                      '  Me.materialID.Requery
                     'Case 5
                      '  Me.materialID.Requery
                  End Select
                  End Sub
                  Originally posted by ChipR
                  Ok. Your record source in your previous post had Combo10 in it, so I'm assuming you fixed that. Your control sources for each subform should not be the same. What would be the point of having 5? There should be one subform for each category, and each has it's control source showing records of that category. You don't change the subforms' data, you change which is visible.

                  You should have code in the after update event of the combo box controlling the tabs and select case on the value of the combo box.
                  Last edited by csolomon; Mar 26 '09, 03:20 PM. Reason: Also, now, my matTypeId will not allow me to make changes to the selection in the box.

                  Comment

                  • OldBirdman
                    Contributor
                    • Mar 2007
                    • 675

                    #24
                    How do the rules change w/ each post?
                    Post #1 has a material category
                    I have 5 categories of material types
                    , but this went away, to return in post #8.
                    so now where I use to have 1 form, I have 5, representing one of the 5 categories of materials
                    Has 5 forms, not one as in Post #1.

                    Moving forward. Yes, ChipR was giving good code ideas. I posted because the thread didn't seem to be moving forward.

                    I guess you cannot hide all tabs individually on a tab control, so you are correct, one tab still shows. You would have to hide the tab control itself to hide all tabs.

                    The last post, #19,
                    I have a tabControl, tabCtl1 that has 5 tabs that represent each category of material type.
                    I am still not sure category is in the table structure. Are you using "material type" and "category of material type" to mean the same thing?

                    Not to deal with the display of data yet, I see a form, F_Test2_MixDesi gn, with a tab control, tabCtl1, on that form. The tabs would be labeled "CementType ", "CoarseType",.. . "Chemicals" . Selecting one of these tabs would display the data, for that material type, on the tab chosen.

                    I see an event subroutine tabCtl1_Change( ) that will eventually process your data, but for now might be
                    Code:
                    Private Sub tabCtl1_Change()
                        MsgBox "Tab chosen is " & tabCtl1.Pages(tabCtl1).Name
                    End Sub
                    Am I correct so far?

                    Comment

                    • csolomon
                      New Member
                      • Mar 2008
                      • 166

                      #25
                      Code:
                      I am still not sure category is in the table structure. Are you using "material type" and "category of material type" to mean the same thing?
                      Yes I was...it's actually called matType, for material Type

                      I tried to use that Change routine you sent, but unfortunately, my matTypeID combo box is not allowing me to change it.
                      You are correct so far.

                      Originally posted by OldBirdman
                      Post #1 has a material category, but this went away, to return in post #8. Has 5 forms, not one as in Post #1.

                      Moving forward. Yes, ChipR was giving good code ideas. I posted because the thread didn't seem to be moving forward.

                      I guess you cannot hide all tabs individually on a tab control, so you are correct, one tab still shows. You would have to hide the tab control itself to hide all tabs.

                      The last post, #19, I am still not sure category is in the table structure. Are you using "material type" and "category of material type" to mean the same thing?

                      Not to deal with the display of data yet, I see a form, F_Test2_MixDesi gn, with a tab control, tabCtl1, on that form. The tabs would be labeled "CementType ", "CoarseType",.. . "Chemicals" . Selecting one of these tabs would display the data, for that material type, on the tab chosen.

                      I see an event subroutine tabCtl1_Change( ) that will eventually process your data, but for now might be
                      Code:
                      Private Sub tabCtl1_Change()
                          MsgBox "Tab chosen is " & tabCtl1.Pages(tabCtl1).Name
                      End Sub
                      Am I correct so far?

                      Comment

                      • OldBirdman
                        Contributor
                        • Mar 2007
                        • 675

                        #26
                        I know it's difficult to communicate with 2 people simultaneously, but ChipR is working from a different perspective, so one of us will help get to a solution.

                        Not to deal with the display of data yet, I see a form, F_Test2_MixDesi gn, with a tab control, tabCtl1, on that form. The tabs would be labeled "CementType ", "CoarseType",.. . "Chemicals" . Selecting one of these tabs would display the data, for that material type, on the tab chosen. Am I correct so far?
                        You are correct so far.
                        I'm not sure why you need this combobox. Why can't you use the tabs of tabCtl1 and eliminate the combobox?

                        Comment

                        • csolomon
                          New Member
                          • Mar 2008
                          • 166

                          #27
                          You are right OldBirdman, it is but I am sure we will arrive at a viable solution.

                          Since matTypeID is a field in the table, wouldnt' I need to somehow connect the tab with what the matTypeID it represents??? If not, then the user will have to select the material type so the record in the table will be filled in. I think that would be redundant since the tabs suggest the matType, even though it's just a label?


                          Originally posted by OldBirdman
                          I know it's difficult to communicate with 2 people simultaneously, but ChipR is working from a different perspective, so one of us will help get to a solution.


                          I'm not sure why you need this combobox. Why can't you use the tabs of tabCtl1 and eliminate the combobox?

                          Comment

                          • OldBirdman
                            Contributor
                            • Mar 2007
                            • 675

                            #28
                            I would expect that the tab Captions have meaningful (to your users) names, such as Cement Type, Coarse Type, Fine, Pigments, and Chemicals. If the user wants "Pigments", they select the tab with that name.

                            Connecting this to a table comes later. For now, the form needs to determine what the user wants. If it cannot do that, you cannot proceed to the code to display data.

                            This is why I said "STOP". Step 1 is to determine what you need from your user, and how to get it. That is the purpose of your primary form. You can use a textbox, a combobox, a listbox, or a tab control to select a material type. That is your choice. You do not want both a combobox and a tab control to make your choice.

                            You wanted to display your data on a tab page. This is good. It means that your user makes a choice, and the name they clicked (the tab caption) is displayed as a heading for the data.

                            I still don't get why for the moment your form doesn't have 1 control, a tab control. This would have 5 tabs. For now, tab 0 would have a caption of "Cement Type" and a label on that tab page with a caption "Data for Cement Type will go here".

                            Comment

                            • ChipR
                              Recognized Expert Top Contributor
                              • Jul 2008
                              • 1289

                              #29
                              Originally posted by csolomon
                              Since matTypeID is a field in the table, wouldnt' I need to somehow connect the tab with what the matTypeID it represents???
                              The subform on each tab is set to show only the records with the matTypeID for that tab. It's hard coded, and doesn't change.

                              Comment

                              • csolomon
                                New Member
                                • Mar 2008
                                • 166

                                #30
                                Code:
                                I have cleared out all code telling my tabs to appear visible or invisible, yet when I open my form, it still only shows the one cement tab.
                                fixed this piece!

                                I still don't get why for the moment your form doesn't have 1 control, a tab control. This would have 5 tabs. For now, tab 0 would have a caption of "Cement Type" and a label on that tab page with a caption "Data for Cement Type will go here"
                                It does have 1 control, a tab control. it has 5 tabs. On each tab is a subform

                                I named my tabs: pgeOne, pgeTwo, pgeThree, pgeFour, pgeFive

                                Originally posted by OldBirdman
                                I would expect that the tab Captions have meaningful (to your users) names, such as Cement Type, Coarse Type, Fine, Pigments, and Chemicals. If the user wants "Pigments", they select the tab with that name.

                                Connecting this to a table comes later. For now, the form needs to determine what the user wants. If it cannot do that, you cannot proceed to the code to display data.

                                This is why I said "STOP". Step 1 is to determine what you need from your user, and how to get it. That is the purpose of your primary form. You can use a textbox, a combobox, a listbox, or a tab control to select a material type. That is your choice. You do not want both a combobox and a tab control to make your choice.

                                You wanted to display your data on a tab page. This is good. It means that your user makes a choice, and the name they clicked (the tab caption) is displayed as a heading for the data.

                                I still don't get why for the moment your form doesn't have 1 control, a tab control. This would have 5 tabs. For now, tab 0 would have a caption of "Cement Type" and a label on that tab page with a caption "Data for Cement Type will go here".

                                Comment

                                Working...