Let's go shopping!
My shop is http:376512972.paipai.com
Richard:
I'd suggest that you decompose the tblnapswork table into two tables, one to
represent each job as a whole, and one to represent the sub-jobs. The
columns of the former would represent the attributes of the job as a whole,
while the columns of the latter would represent the attributes specific to
the sub-job. That way any redundancy, and possible inconsistencies arising
from this, is avoided.
The key of the jobs table can remain as existing, i.e. the jobnumber. The
sub-jobs table would also have a jobnumber columns as a foreign key
referencing the primary key of the jobs table. It would also contain a
subcode column (or whatever you want to call it), numbered from 1 upwards for
each job. Together these two columns would form the primary key of the
sub-jobs table.
Both the jobnumber and subcode columns can be integer number data types.
They can easily be combined in a query, form or report as:
Format(jobnumber,"0000") & "/" & Format(subcode,"000")
For data entry a jobs form with a sub-jobs subform, linked on jobnumber,
would be appropriate. You can automatically generate the subcodes in the
same way as the jobnumbers with:
DMax("subcode", "subjobs", "jobnumber = " & [jobnumber]) + 1
A further argument for decomposing the table is that while the subcode could
still be automatically generated easily if a single table were used, the
jobnumber could not be. With two tables on the other hand the jobnumber is
determined when a new row is inserted into the jobs table, this is
automatically assigned to each subjob by the link between the form and
subform, and the subcode can then be automatically generated as above.
Bear in mind (and this applies to your current scenario too) that in a
multi-user environment on a network there is the possibility of the same
number being returned by the DMax function for separate users if they are
adding new records simultaneously. It important, therefore that the columns
are correctly indexed so as to prevent duplicate values being saved to the
table.
Ken Sheridan
Stafford, England
> Hi
>
[quoted text clipped - 45 lines]
>
> Richard