If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Table Design
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 |
#2
|
|||
|
|||
On Sun, 24 Apr 2005 19:36:05 -0400, wrote:
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? 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] |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Seeking some expert advice. | HD87glide | Using Forms | 14 | March 23rd, 2005 10:11 PM |
unable to repair inobox | Sudheer Mumbai | General Discussion | 1 | February 20th, 2005 11:55 AM |
Manual line break spaces on TOC or Table of tables | Eric | Page Layout | 9 | October 29th, 2004 04:42 PM |
Autonumber | Ally H. | General Discussion | 7 | August 27th, 2004 04:51 PM |
COMPARE THE TWO TABLES | Stefanie | General Discussion | 0 | June 4th, 2004 04:36 PM |