473,418 Members | 2,070 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,418 software developers and data experts.

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 1321
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_DESCRIPTION | . . . (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_DESCRIPTION | 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_DESCRIPTION | . . . (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.google.c om...
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.*********@heuvelqop.nl> wrote in message news:<cn**********@news2.solcon.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
LinkMasterFields 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.*********@heuvelqop.nl> wrote in message news:<cn**********@news2.solcon.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
LinkMasterFields 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.google. com>...
Bas Cost Budde <b.*********@heuvelqop.nl> wrote in message news:<cn**********@news2.solcon.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
LinkMasterFields 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_BeforeUpdate(Cancel As Integer)
Dim strMsg As String
If IsNull(Me.Control_Numer) Then
Cancel = True
strMsg = strMsg & "Control_Numer is required." & vbCrLf
End If
If IsNull(Me.Control_Numer) Then
Cancel = True
strMsg = strMsg & "AnotherField 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_BeforeUpdate(Cancel As Integer)
Dim strMsg As String
If IsNull(Me.Control_Numer) Then
Cancel = True
strMsg = strMsg & "Control_Numer is required." & vbCrLf
End If
If IsNull(Me.Control_Numer) Then
Cancel = True
strMsg = strMsg & "AnotherField 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
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...
3
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...
12
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...
7
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...
28
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...
3
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
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...
2
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...
9
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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
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,...
0
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...
0
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...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...

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.