I’ve got another situation with filling in fields in one table based on fields in another.
First I think I have a structural problem. In my production tracking database, I have the query FundingByCategoryAndSource, which shows only the projects for which I actually need funding. Fields are ProjectName, FundingFY, FundType, FundingSource, and FundingAmount, all drawn from tblFunding. To plan and track funding obligations, I need to be able to see all of this information, PLUS the following: ObligationNeededBy; DateObligated; RQ#; AmountBilled; and DatePaid.
Initially I included these fields in the table tblFunding, but now I realize that this would capture only a single obligation for each project, whereas I can have up to 4 different obligations, which may or may not need different dates depending on the type of funding. So I think I need to handle the underlying structure differently, but I don’t know how. Separate table? Query? Report?
I need to end up with a new ObligationTracking table (or report, or whatever it ends up being) in which I can see the date each particular type of funding needs to be obligated, and from which I can run other reports and queries. The ObligationNeededBy date will come from one of four fields in tblContentproduction (PlannedDateToDesigner/Indexer/Printer/Purchase), based on a combination of the values in FundingFY, FundType, and FundingSource.
General business rules:
^Funds can be obligated for 1Design, 2Index, 3Printing, or 4Purchase (identified in tblFundType).
^Each project could have any or all of the four funding types, but only one instance of each type.
^Each funding type comes from a single funding source, either 1Pubs, 2Contract, or 3CreditCard (identified in tblFundingSource).
^A project can have any or all of the three funding sources, and may have more than one type of obligation from the same funding source.
^Three of the fund types (index, printing, and purchase) can only be funded from a specific source. One of the fund types (design) may be funded from either of two sources.
^Different funding types may be obligated in the same FundingFY, or in different FundingFYs.
How funding types and sources will feed the ObligationNeededBy field:
1) Projects with FundType=1Design could come from either FundingSource=2Contract or FundingSource=1Pubs. Either way, I need to see the date from tblContentProduction.PlannedDateToDesigner.
2) Projects with FundType=2Index will only ever come from FundingSource=2Contract. I need to see the date from tblContentProduction.PlannedDateToIndexer.
3) Projects with FundType=4Purchase will only ever come from FundingSource=3CreditCard. I need to see the date from tblContentProduction.PlannedDateToPurchase.
4) The most squirrely one: FundType=3Printing will only ever come from FundingSource=1Pubs, BUT design and printing may or may not be obligated concurrently, depending on the FundingSource and the FundingFY. Specifically:
##If a project with FundType=3Printing has no related entry with FundType=1Design, printing will be a unique obligation so I only need to see tblContentProduction.PlannedDateToPrinter.
##If a project with FundType=3Printing also has an entry for FundType=1Design which has FundingSource=2Contract, printing will be a unique obligation so I need to see the date from tblContentProduction.PlannedDateToPrinter. (See ProjectC)
##If a project with FundType=3Printing also has FundType=1Design with FundingSource=1Pubs in a different FundingFY, printing will be a unique obligation so I need to see the date from tblContentProduction.PlannedDateToPrinter. (See ProjectA)
##If a project with FundType=3Printing also has an entry for FundType=1Design which has FundingSource=1Pubs, and the two fund types occur in the same FundingFY, there will be a single obligation. So while the project will still have a PlannnedDateToPrinter in tblContentProduction, the obligation is triggered by the earlier of the two dates, which will always be design. So I’m not sure if we should still show DateToPrinter as the ObligationNeededBy for these cases and then run another query to test for this situation, or what. Note that I will also need to see the total obligation needed on that date, so would need to add the amounts in Design and Printing. (See ProjectB)
Sorry this is so long, I can see where I want to go but am not sure if I’m explaining it in a way that makes sense to anyone else. ;-) I’m attaching a sample db in 2003 as well as screenshots of the query and the relationships in case that helps.
Thanks for your help!