473,799 Members | 3,245 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Looking for suggestion or help

I'm trying to make what should be a simple DB, but have done got
myself confused. I'm trying to keep track of the contents of several
kits that use common components. Each component has a unique number
and each kit has a unique number. I would like to be able to pull up
the kit number them choose the individual components that are included
in that kit and keep that record so if any components are changed it
would update the kit.
Nov 13 '05 #1
7 1341
S Wilson,
It is a simple database. It is called a bill of materials. There are two
basic schemas. The first uses a single table with an added column to track
what belongs to what. So:
ITEM_ID | ITEM_NO | ITEM_NAME | ITEM_DESCRIPTIO N | . . . (and whatever else
you need) ITEM_KIT_ID. Kit ID would be the row id of the item that
represents the kit.

For example:
ITEM_ID | ITEM_NO | ITEM_NAME | ITEM_DESCRIPTIO N | ITEM_KIT_ID
----------+------------+----------------+------------------------+-----------------
1 | 10 | Duck | Donald Duck
|
2 | 20 | Duck Nose | Donald Duck's Nose
| 1

I can know a couple things from this list. First Item 1 is a finished good
because it has no kit number (it doesn't belong to something else) Second,
Item 2 is part of Item 1 because if its kit id.

The limitation in this design is that because it is a one-to-many
relationship it doesn't easily handle complex builds where some parts are
components of some other parts. It would also be a pain to track
consumables like shrinkwrap, glue or assembly hardware like screws. So, to
fix this a variation on this design is needed. You need to add a table that
tracks which components are part of which other components--your Bill of
Materials table or BOM. So the Item Master table above changes slightly to:

ITEM_ID | ITEM_NO | ITEM_NAME | ITEM_DESCRIPTIO N | . . . (and whatever else
you need)

Kit ID is moved to the BOM table:
ITEM_ID | KIT_ID | FINISHED_GOOD. . . (and whatever else you need related to
this item and kit)

Finished good is a true/false flag included for reporting performance so you
don't need a sub-query to look for null kit id (meaning finished good) It
also allows your management to flag things as finished goods as it suits the
business even though the finished good may be a component of something else.

Bills of materials are a classic example of working with hierarchical data.
There are lots of others, including geneology and organizational charts.
There is a third solution to this problem I didn't list because it is
somewhat unorthodox and also because as a teacher I think students should be
left with something to do.

"Swilson513 " <sw********@aol .com> wrote in message
news:4f******** *************** ***@posting.goo gle.com...
I'm trying to make what should be a simple DB, but have done got
myself confused. I'm trying to keep track of the contents of several
kits that use common components. Each component has a unique number
and each kit has a unique number. I would like to be able to pull up
the kit number them choose the individual components that are included
in that kit and keep that record so if any components are changed it
would update the kit.

Nov 13 '05 #2
Swilson513 wrote:
I'm trying to make what should be a simple DB, but have done got
myself confused. I'm trying to keep track of the contents of several
kits that use common components. Each component has a unique number
and each kit has a unique number. I would like to be able to pull up
the kit number them choose the individual components that are included
in that kit and keep that record so if any components are changed it
would update the kit.


You have three objects that each get their own table:

component (unique number, description, what else)
kit (unique number, description)
composition (kit number, component number, possibly amount)

Set up your relationships--well, in the database--such that there is a
one-to-many from both component and kit to composition. These
relationships should be enforced, and I advise cascaded updates.
Nov 13 '05 #3
Bas Cost Budde <b.*********@he uvelqop.nl> wrote in message news:<cn******* ***@news2.solco n.nl>...
Swilson513 wrote:
I'm trying to make what should be a simple DB, but have done got
myself confused. I'm trying to keep track of the contents of several
kits that use common components. Each component has a unique number
and each kit has a unique number. I would like to be able to pull up
the kit number them choose the individual components that are included
in that kit and keep that record so if any components are changed it
would update the kit.


You have three objects that each get their own table:

component (unique number, description, what else)
kit (unique number, description)
composition (kit number, component number, possibly amount)

Set up your relationships--well, in the database--such that there is a
one-to-many from both component and kit to composition. These
relationships should be enforced, and I advise cascaded updates.


OK I have created 3 tables Componets, kits and Complete Kit. I have a
one to many relationship from Componets and Kits to the complete kit.
Now I would like to have a form that is used to build the kits. I
would like to pull up the complete kit number and be able to add
componets to it using a drop down list from the componets. Any
suggestions on doing this??

TIA
Nov 13 '05 #4
Swilson513 wrote:
OK I have created 3 tables Componets, kits and Complete Kit. I have a
one to many relationship from Componets and Kits to the complete kit.
Now I would like to have a form that is used to build the kits. I
would like to pull up the complete kit number and be able to add
componets to it using a drop down list from the componets. Any
suggestions on doing this??


Yes. Your form fills in kits, represented in this data model by several
rows in the complete-kit table. That means it should be based on this table.

To have the relation with kits in view, create a form on Kits, and have
the before form as subform here. Be sure the data properties
LinkMasterField s and LinkChildFields of the subform control are set--if
you have set up the relationships as mentioned, they should be filled in
automatically.

In the data subform, you can have the component field be a combobox
control; its *controlsource* is the table (complete kit) field, its
*rowsource* the components table.

Did you spell 'componets' indeed? :-)
Nov 13 '05 #5
Bas Cost Budde <b.*********@he uvelqop.nl> wrote in message news:<cn******* ***@news2.solco n.nl>...
Swilson513 wrote:
OK I have created 3 tables Componets, kits and Complete Kit. I have a
one to many relationship from Componets and Kits to the complete kit.
Now I would like to have a form that is used to build the kits. I
would like to pull up the complete kit number and be able to add
componets to it using a drop down list from the componets. Any
suggestions on doing this??


Yes. Your form fills in kits, represented in this data model by several
rows in the complete-kit table. That means it should be based on this table.

To have the relation with kits in view, create a form on Kits, and have
the before form as subform here. Be sure the data properties
LinkMasterField s and LinkChildFields of the subform control are set--if
you have set up the relationships as mentioned, they should be filled in
automatically.

In the data subform, you can have the component field be a combobox
control; its *controlsource* is the table (complete kit) field, its
*rowsource* the components table.

Did you spell 'componets' indeed? :-)


Well it looked good at the time Components.

Thanks for the help, I'm sure I'll need more.

Thanks Again
Nov 13 '05 #6
sw********@aol. com (Swilson513) wrote in message news:<4f******* *************** ****@posting.go ogle.com>...
Bas Cost Budde <b.*********@he uvelqop.nl> wrote in message news:<cn******* ***@news2.solco n.nl>...
Swilson513 wrote:
OK I have created 3 tables Componets, kits and Complete Kit. I have a
one to many relationship from Componets and Kits to the complete kit.
Now I would like to have a form that is used to build the kits. I
would like to pull up the complete kit number and be able to add
componets to it using a drop down list from the componets. Any
suggestions on doing this??


Yes. Your form fills in kits, represented in this data model by several
rows in the complete-kit table. That means it should be based on this table.

To have the relation with kits in view, create a form on Kits, and have
the before form as subform here. Be sure the data properties
LinkMasterField s and LinkChildFields of the subform control are set--if
you have set up the relationships as mentioned, they should be filled in
automatically.


In the data subform, you can have the component field be a combobox
control; its *controlsource* is the table (complete kit) field, its
*rowsource* the components table.

Did you spell 'componets' indeed? :-)


Well it looked good at the time Components.

Thanks for the help, I'm sure I'll need more.

Thanks Again


Finally just about everything is working, how could something so easy
be so confusing??

Another question, I need to not allow or at least warn when exiting a
required field on a FORM. I found this information but can't seem to
get it to work. The name of the field is Control Numer (yes another
spelling error on my field:)Do you see what is wrong or other
suggestion?

My field was actually "Control Numer" but with out the "_" I would get
errors.
Private Sub Control_Numer_B eforeUpdate(Can cel As Integer)
Dim strMsg As String
If IsNull(Me.Contr ol_Numer) Then
Cancel = True
strMsg = strMsg & "Control_Nu mer is required." & vbCrLf
End If
If IsNull(Me.Contr ol_Numer) Then
Cancel = True
strMsg = strMsg & "AnotherFie ld is required." & vbCrLf
End If
'Repeat for other fields as needed.
If Cancel Then
MsgBox strMsg
End If

End Sub

Thank You
Nov 13 '05 #7
Swilson513 wrote:
Finally just about everything is working, how could something so easy
be so confusing??
Right: once you know, it seems easy.
Another question, I need to not allow or at least warn when exiting a
required field on a FORM.
You can set the field to be required (that is a property visible in
Design view of the table). That way the user does get a warning, but not
immediately after leaving the field. If you have many fields on the
form, it may be too vague for the user.

You could as further hint change the backcolor of every control that
sits on a required field, so there is some visual cue for the user which
fields need a value. I wrote routines that look up the Required property
of the fields and color the controls accordingly. Interested?

Be aware that if you forbid the user to exit the control unless a value
is entered, that constitutes a trap for the user. A warning seems better
to me than confinement.
My field was actually "Control Numer" but with out the "_" I would get
errors.
True, Access changes the spaces in control names to underscores when
using it in code.
Private Sub Control_Numer_B eforeUpdate(Can cel As Integer)
Dim strMsg As String
If IsNull(Me.Contr ol_Numer) Then
Cancel = True
strMsg = strMsg & "Control_Nu mer is required." & vbCrLf
End If
If IsNull(Me.Contr ol_Numer) Then
Cancel = True
strMsg = strMsg & "AnotherFie ld is required." & vbCrLf
End If
'Repeat for other fields as needed.
If Cancel Then
MsgBox strMsg
End If


First, you should check for every control you want to do this for in its
*own* event handler. Control_Numer gets one, AnotherField too, and so on.

Second, consider using the Exit event. That has a Cancel property as
well, and I'm not sure of exactly when BeforeUpdate fires. You can check
that in the Help on "event order" or so.
--
Bas Cost Budde, Holland
http://www.heuveltop.nl/BasCB/msac_index.html
I prefer human mail above automated so in my address
replace the queue with a tea
Nov 13 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2605
by: Mike | last post by:
Hello, I'm looking to create a PHP script that will automatically generate an index/menu/list (whatever) based on the PDF files that are within a particular directory. I would like the script to be able to parse out the title, description, author(s), and date from the documents, and use that information to create the index. Any suggestions on how to do something like this?
3
2387
by: Tomas | last post by:
Hi! I'm looking for a replacement for the standard interactive python shell. So far I've tried IPython and PyCrust. I liked both, but I'm not 100% happy with any of them. My main complaint about IPython is its missing support for multiline editing. To do multiline editing, it has to start an external editor, but then I lose all the nice features like autocompletion. PyCrust supports multiline editing, but the autocompletion is not as...
12
1659
by: Charles Law | last post by:
Hi guys A bit of curve ball here ... I have a document (Word) that contains a series of instructions in sections and subsections (and sub-subsections). There are 350 pages of them. I need to translate these instructions into something that can be processed automatically, so I have used the Command pattern to set up a set of commands that correspond to the various instructions in the document.
7
1647
by: Master of C++ | last post by:
Hello Folks, I have a programming dilemma with templates and "genericity". I can think of a few solutions, but I am not sure which one is the best in terms of genetic C++ style. Any suggestions will be greatly appreciated. I am writing a template class Polynomial that encapsulates the functionalities of a Polynomial. Here is a rough sketch for the class:
28
2750
by: John McCabe | last post by:
Hi I'm looking for something equivalent to the Data Structures and Algorithms in Ada 95 books by Biedler and Feldman etc, but based towards efficient C++ implementations. Does anyone know of such a thing and could recommend one? I'm particularly interested in coverage of binary search trees, especially Red-Black, Splay and AVL, as well as hashing tables and
3
1172
by: M.B | last post by:
Hi, I'm looking a .net component (third party or not) that I could include - Text - Image - RadioButton - CheckBox any idea, link or suggestion ? I use VS 2002
9
1942
by: vbfoobar | last post by:
Hello I am looking for python code that takes as input a list of strings (most similar, but not necessarily, and rather short: say not longer than 50 chars) and that computes and outputs the python regular expression that matches these string values (not necessarily strictly, perhaps the code is able to determine patterns, i.e. families of strings...).
2
1081
by: John | last post by:
Hi I am looking for an exception handler that can handle all unhanded exceptions in my vb2005 app and also email the exception log to myself. There is one here http://www.codeproject.com/dotnet/ExceptionHandling.asp but it only works with vb2003. Any help would be appreciated. Thanks Regards
9
1590
by: Ming | last post by:
I am looking for a PHP based CMS (or blog system) that supports: 1) static output (like Movable Type) 2) remote publishing through FTP, SFTP or SSH (like Blogger) 3) Different templates for different parts of the system (ie: category template, main index template, search template, like Movable Type does; Blogger seems to just have one template) 4) Free (or low price for multiple installations) 5) One central installation for multiple...
0
9687
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9541
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
10484
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10251
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
10228
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
10027
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...
1
4141
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
2
3759
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2938
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.