473,770 Members | 4,355 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Control Tab Possibllities

166 New Member
Hello:

I have something I would like to do and I was wondering if tab controls was the best route to accomplish it.

I have 5 categories of material types. I created the application from an excel sheet that had the categories listed. My boss would like my form to be as close as possible to the excel sheet. He would like for 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. 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. My idea was that based on the matType selected, the continuous subform would populate with records related to that matType, in addition allow user to add data for that matType. Initially I thought I could have one form and have the data load based on the matType, however, I never was able to make it happen using one form. I now have a form representing all of my categories and the query that is the form's record source is filtered by the matType that the subform represents. Here is what a query for matType1 looks like:

Expand|Select|Wrap|Line Numbers
  1. 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)=1)); 
Additionally, the materialID combo box allows the user to select the material related to that matType they are using.

I have a few questions:

1) When all 5 categories of materials are input, I need a running total that will use different information entered. Since I have different information on different forms, on diff tabs, is this possible? I ask bc even when I had everything together, it was funky about my subtotals. I had to have a text box on the subform calculate it and then on the main form just copy from the subform text box.

2) I have been trying to make it so that when the user selects a matType (located on the subform), the subform and tab it sits on, go invisible with the exception of the selected tab...I have tried so many things, but nothing works. I use a select case statement to drive the tabs:

Tab Control Name: Tabctl1 (Access does not seem to recognize my tab control name)
Tab 0 Name: pgeOne
Tab 1 Name: pgeTwo
Tab 2 name: pgeThree
" 3 " : pgeFour
" 4 " : pgeFive

I have tried:

Private Sub matTypeID_After Update()
Select Case matTypeID

Case 1

Me.materialID.R equery
Me!TabCtl1.Page s(0).SetFocus

Case 2
Me.materialID.R equery
Me.Tabctl1.Page s.Item("pgeOne" ).SetFocus

etc...(I have not included the whole case statement). Neither format in case 1
or 2 works. I found this information here: http://bytes.com/topic/access/insigh...bs-tab-control

Will I be able to keep a total of the data I need, even though the calculations are stored in the footer of several forms and on the main form?

Please feel free to ask additional questions related to my issue. I appreciate any assistance.
Mar 25 '09
56 5053
ChipR
1,287 Recognized Expert Top Contributor
Always have a

Case Else
MsgBox "Unexpected Case"
Mar 26 '09 #11
csolomon
166 New Member
OK...I made the selection based on the matTypeID, as opposed to tabCtl1. I then put a dot to see if the matTYpeID was being passed when the page loaded and it was empty...so I am not sure how to proceed. Also, the unexpected case box popped up. I tried to troubleshoot the field value:

Expand|Select|Wrap|Line Numbers
  1. ?Form!F_Test2_MixDesign!SF_CementType.Form!matTypeID
also:
Expand|Select|Wrap|Line Numbers
  1. ?SF_CementType.Form!matTypeID
and got runtime error 424, Object Required.


@ChipR
Mar 26 '09 #12
ChipR
1,287 Recognized Expert Top Contributor
I'm not sure what the matTypeID is. You said you have a text box for the user to input the matType, and you want to show the appropriate tab according to that. Just make sure you have a default value in that conrol, or set one in the onLoad event, and you can select case on that. Unless I'm misunderstandin g the way you want the form to function.
Mar 26 '09 #13
csolomon
166 New Member
matTypeID represents the different categories that can be selected from. Since I have a form for each category, the control source for each form is restricted to the matTypeID I chose as the criteria...for instance matTypeID 1, Cement, would return to the form all records where the matTypeID is 1. So the text box's default value already represents the matTYpeID. The user does not have to input. Maybe that's why it isn't working. I noticed that always tab zero is visible and the others are invisible.

You understand correctly. I just didn't think it would be this difficult to accomplish this.

@ChipR
Mar 26 '09 #14
ChipR
1,287 Recognized Expert Top Contributor
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.
Mar 26 '09 #15
csolomon
166 New Member
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:

Expand|Select|Wrap|Line Numbers
  1. Select Case matTypeID
  2.  
  3.    Case Is = 1
  4. TabCtl1.Pages(1).Visible = False
  5. TabCtl1.Pages(2).Visible = False
  6. TabCtl1.Pages(3).Visible = False
  7. TabCtl1.Pages(4).Visible = False
  8.  
  9.    Case Is = 2
  10. TabCtl1.Pages(0).Visible = False
  11. TabCtl1.Pages(2).Visible = False
  12. TabCtl1.Pages(3).Visible = False
  13. TabCtl1.Pages(4).Visible = False
  14.  
  15.    Case Is = 3
  16. TabCtl1.Pages(1).Visible = False
  17. TabCtl1.Pages(0).Visible = False
  18. TabCtl1.Pages(3).Visible = False
  19. TabCtl1.Pages(4).Visible = False
  20.  
  21.    Case Is = 4
  22. TabCtl1.Pages(1).Visible = False
  23. TabCtl1.Pages(2).Visible = False
  24. TabCtl1.Pages(0).Visible = False
  25. TabCtl1.Pages(4).Visible = False
  26.  
  27.    Case Is = 5
  28. TabCtl1.Pages(1).Visible = False
  29. TabCtl1.Pages(2).Visible = False
  30. TabCtl1.Pages(3).Visible = False
  31. TabCtl1.Pages(0).Visible = False
  32.  
  33.    Case Else
  34. MsgBox "Unexpected Case"
  35. 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

@ChipR
Mar 26 '09 #16
ChipR
1,287 Recognized Expert Top Contributor
That's because you're selecting case on matTypeID and not combo10.
Mar 26 '09 #17
OldBirdman
675 Contributor
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.
Mar 26 '09 #18
csolomon
166 New Member
Expand|Select|Wrap|Line Numbers
  1. 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.

Expand|Select|Wrap|Line Numbers
  1. Note: The code in Post #8 will hide ALL TABS after 2 calls to the subroutine.
This explains why only one tab shows up!

Expand|Select|Wrap|Line Numbers
  1.   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

Expand|Select|Wrap|Line Numbers
  1. 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).
Expand|Select|Wrap|Line Numbers
  1. 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:
Expand|Select|Wrap|Line Numbers
  1. 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)); 
Expand|Select|Wrap|Line Numbers
  1. 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

@OldBirdman
Mar 26 '09 #19
ChipR
1,287 Recognized Expert Top Contributor
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
Mar 26 '09 #20

Sign in to post your reply or Sign up for a free account.

Similar topics

6
3417
by: Bruce Rusk | last post by:
I'm using Stephen Lebans' RTF2 control in a report, and have discovered what may be a slight bug in it. I have a lot of non-Western language (Chinese) text in my RTF field, and such records get sized strangely using the .RTFHeight property of the control. Specifically, lines of text get cut off the bottom of the control when I use the code provided in the sample report on the lebans.com site. It seems that when there is Chinese text,...
6
11300
by: martin | last post by:
Hi, I am a web page and a web user control. My web user control is placed in my web page using the following directive <%@ Register TagPrefix="uc1" TagName="Header" Src="WebControls/Header.ascx" %> The web user control contains the following server controls
2
3629
by: John Lau | last post by:
Hi, Is there documentation that talks about the page lifecycle, the lifecycle of controls on the page, and the rendering of inline code, in a single document? Thanks, John
20
5650
by: Guadala Harry | last post by:
In an ASCX, I have a Literal control into which I inject a at runtime. litInjectedContent.Text = dataClass.GetHTMLSnippetFromDB(someID); This works great as long as the contains just client-side HTML, CSS, etc. What I want to do is somehow insert a *server control* into the , then set the server control's properties at runtime.
5
3595
by: serge calderara | last post by:
Dear all, I am new in asp.net and prepare myself for exam I still have dificulties to understand the difference between server control and HTML control. Okey things whcih are clear are the fact that for server control component , code is running on the server side. But if I take as example a Label. I place on a webform an HTM label control and a WebForm label control, I could see that properties are different for
2
4924
by: Mike | last post by:
Hi, I am strugling with a simple problem which I can't seem to resolve. I have an asp.net page which contains a server-control (flytreeview, which is a kind of a tree to be exact). The tree is being updated by some other process through remoting. When the page loads, I init the tree, and in my browser I can see the initialized tree. The problem is that every time that I receive update to tree from the remote process,
4
3346
by: gsb58 | last post by:
Hi! On a form I have a calendar. The form is rezised to 1024x768 (Don't worry - this is a training case) when loaded. Now I want to center the calendar on the form so that its edges are equally far from the upper, right, left and bottom borders of the form. I understand I must use the location property, am I right?
5
2343
by: paul.hester | last post by:
Hi all, I have a custom control with an overridden Render method. Inside this method I'm rendering each control in its collection using their RenderControl method. However, I'm running into a problem in this scenario: <myprefix:mycontrol runat="server"> <%= SomeVariable %> </myprefix:mycontrol>
15
6521
by: rizwanahmed24 | last post by:
Hello i have made a custom control. i have placed a panel on it. I want this panel to behave just like the normal panel. The problem i was having is that the panel on my custom control doesnt accept other controls. The control i drag drop on it becomes the child of my custom control's parent form and not the child of my custom control. Then i added this line "" before my custom control class (i dont know what this line does). Now
0
9439
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10071
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10017
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9882
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6690
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5326
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5467
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3987
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2832
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.