>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]