Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Database Design / April 2005

Tip: Looking for answers? Try searching our database.

Table Design

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jrmask@bellsouth.net - 25 Apr 2005 00:36 GMT
I have a table for Equipment in a plant that contains all information about
the machine in general such as Production Number, Serial Number, Date
Purchased ect. Each machine has several sections that make up the whole such
as Feed section, Print Section and Cut Section. I want to have the main
machine with a number such as 123.000 and each part to list under that
machine such as (Feed) will be 123.001 and so forth. Each parent machine
already has an Equipment ID number that is an auto-number (existing DB) so
that ID 1 will be machine 123, 2 will be another machine. Is there a way to
"nest" the child machine under the parent without creating a table for each
section and each machine?

Whole Machine 123
                   Feed  123.001
                   Print  123.002
                   Cut    123.003

Thanks in advance for your help.

Richard
John Vinson - 27 Apr 2005 04:28 GMT
>I have a table for Equipment in a plant that contains all information about
>the machine in general such as Production Number, Serial Number, Date
[quoted text clipped - 6 lines]
>"nest" the child machine under the parent without creating a table for each
>section and each machine?

This should be stored in TWO fields, not in one. If the main machine
is 123, then the child machine table should have a foreign key to the
EquipmentID field (containing 123), and a *SEPARATE* field ComponentNo
let's call it; this should be a simple Long Integer number field.

To populate it, use a Form to do your data entry; base the Form on the
Equipment table and a Subform on the Components table. In the
subform's BeforeInsert event put code like

Private Sub Form_BeforeInsert(Cancel as Integer)
Me!ComponentNo = NZ(DMax("[ComponentNo]", "[Components]", _
  "[EquipmentID] = " & Me!EquipmentID)) + 1
End Sub

This will look up the largest existing component number for this
EquipmentID (and the NZ() function will return 0 if there are no
components entered yet), add one, and store that value.

You can concatenate the two fields for display purposes using an
expression like

[EquipmentID] & "." & Format([ComponentNo], "000")

                 John W. Vinson[MVP]    
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.