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 / Queries / July 2006

Tip: Looking for answers? Try searching our database.

Help with Master Documents query!

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Geoff - 05 Jul 2006 19:05 GMT
I am designing a document management system. Tables of concern are:

1. tblDocument... DocID, DocName, ActiveStatus
2. tblRevision... DocID, RevID, RevLevel, RevDate, LinkToDoc
3. tblApproval... RevID, EmpID, ApproveStatus, ApproveDate

tblDocument relates to tblRevision with DocID (1:M)
tblRevision relates to tblApproval with RevID (1:M)
EmpID in tbl Approval is a foreign key relating to tblEmployee

So basically, tblDocument contains records for all documents (documents can
be inactivated by the ActiveStatus toggle). Each document can have several
revisions in tblRevision. Each revision can have one or more approvals
required for the revision to be implemented.

Here's the problem...I am trying to write a query for my rptMaster, the
master documents list. I only want those lines printed for:
1. active documents
2. documents with revisions that have all necessary approvals.

I tried writing a query that used totals and then took the maximum
RevisionLevel and where the average of ApproveStatus = True. But this doesn't
work if there is a revision pending. The Select statement finds the latest
revision, but the approvals aren't all true, so it doesn't print a record.

I know I haven't explained this too well. Is there anyone who would care to
tackle this?
Gary Walter - 06 Jul 2006 15:45 GMT
It sounds like you want to

group by DocID (maybe other fields?)

where ActiveStatus = -1

HAVING  Max(ApproveStatus) = -1

i.e., within a group, if *any* revision
was not approved, then max would
be 0 (false)

if *all* in group were approved, then
max would be -1

>I am designing a document management system. Tables of concern are:
>
[quoted text clipped - 26 lines]
> to
> tackle this?
 
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.