I can tell you from personal experience a long time ago that the day will
come when there are 29 required documents. If your tables are in a
normalized structure, no program changes will be required. With your present
structure, all your calculations, forms and reports will need revision. The
revised structure is not very difficult. Something like:
Table Site (siteID, siteName)
Table Document(documentCode, documentName)
Table SiteDocument(siteID, documentCode, siteDocumentStatusTypeCode)
Table SiteDocumentStatusType(siteDocumentStatusTypeCode,
siteDocumentStatusTypeName, isComplete)
Now your site form would have a single subform for the site documents,
instead of 26 fixed controls for the current 26 documents.
Your calculated status would be something like:
Select S.siteID, count(iif(D.isComplete, 1, Null) as CompletedDocumentCount
From Site as S
Left Join SiteDocument As D On D.siteID=S.siteID
Group By S.siteID
You could expand this to include the count of the total number of required
documents, so you got a yes/no for siteDocumentsCompleted.
Sue Compelling said:
Oh no - a TRIPLE growling about normalisation. You experts must hate us
hacks doing dodgey design.
Anyway - John - your response looks possibly the easiest for me to pursue
..
If I told you that the table is called [Sites], the Status field is called
[Status] and the 26 doc fields (cringe) are called [Doc1] through to
[Doc26]
... what is the EXACT code that I would need to use.
Also - I don't fully understand each line of your code so if you have time
to explain what each bit is trying to achieve I'd be really grateful ...
Cheers
Sue
--
Sue Compelling
John W. Vinson said:
On Sun, 31 Aug 2008 17:35:01 -0700, Sue Compelling
Hi
Using ACCESS2000.
My DB is for a specific project that is monitoring the QA statndards of
cellsite construction. For each site to be 'signed off' - there needs
to be
26 documents submitted for assessment.
So - each record has the CellSite #, Address, Territory, Status and then
the
26 doc fields. The [doc x] fields] are populated from option boxes.
My requirement is ... I would like to default the STATUS of "complete"
in
the [status] field once all the [doc x ] fields are denoted complete (or
3).
TIA
Sue
My concerns in the other thread (about normalization) still apply; and
ideally
the STATUS field should not exist in your table but instead be calculated
on
demand... but you can do this in the Form's BeforeUpdate event. Poll
through
the 26 fields and if they're all equal to 3 set the STATUS. Something
like
Private Sub Form_BeforeUpdate(Cancel as Integer)
<any other validity checking goes first>
Dim iDoc As Integer
For iDoc = 1 to 26
If Me.Controls("[Doc " & iDoc & "]) <> 3 Then Exit Sub
Next i
Me!STATUS = "Complete"
End Sub