V
Valerie
I am using Access 2003 and am very new to Access. I have the following:
**PaymentRequestFrm--based upon RequestTbl--general information regarding
the payment request.
**SubFormPaymentRequest1--continuous form based upon DistributeQrySub1--SQL
view below
SELECT DistributionTbl.DistributionNumber, DistributionTbl.RequestNumber,
DistributionTbl.GLNumber, DistributionTbl.[Div-Dept],
DistributionTbl.DistributionAmount, BudgetTbl.BudgetAmount,
DistributionTbl!GLNumber & "-" & DistributionTbl![Div-Dept] AS
AccountNumber, IIf([Div-Dept] Is Null,1,0) AS ErrCk
FROM DistributionTbl LEFT JOIN BudgetTbl ON (DistributionTbl.GLNumber =
BudgetTbl.GLNumber) AND (DistributionTbl.[Div-Dept] =
BudgetTbl.DivisionDepartment);
**SubFormPaymentRequest2--continuous form based upon DistributeQrySub2 to
add up all DistributionAmounts for all Account Numbers--SQL view below
SELECT DistributeQryMain.GLNumber, DistributeQryMain.[Div-Dept],
DistributeQryMain.SumOfDistributionAmount, BudgetTbl.BudgetAmount,
[BudgetAmount]-[SumOfDistributionAmount] AS RemainingBudget
FROM (DivDeptTbl INNER JOIN DistributeQryMain ON DivDeptTbl.[Div-Dept] =
DistributeQryMain.[Div-Dept]) INNER JOIN BudgetTbl ON
(DistributeQryMain.GLNumber = BudgetTbl.GLNumber) AND (DivDeptTbl.[Div-Dept]
= BudgetTbl.DivisionDepartment)
GROUP BY DistributeQryMain.GLNumber, DistributeQryMain.[Div-Dept],
DistributeQryMain.SumOfDistributionAmount, BudgetTbl.BudgetAmount,
[BudgetAmount]-[SumOfDistributionAmount];
SQL for DistributeQryMain
SELECT DistributQrySub1.GLNumber, DistributQrySub1.[Div-Dept],
Sum(DistributQrySub1.DistributionAmount) AS SumOfDistributionAmount
FROM DistributQrySub1
GROUP BY DistributQrySub1.GLNumber, DistributQrySub1.[Div-Dept];
All queries, tables, and forms work like I need them to, except I need to
filter the DistributeQry2 for the SubFormPaymentRequest2 based upon the
GLNumber field and DivDept field in SubFormPaymentRequest1.
The PaymentRequestFrm has a total Amount Field and the
SubFormPaymentRequest1 can have a various number of lines that must equal
the total amount on the PaymentRequestFrm.
Example
SubFormPaymentRequest1 entered previously for Request #1 has the following
GL Div-Dept Amt
7586 10-14 $20.00
7502 10-12 $ 6.00
SubFormPaymentRequest1 for Request # 2 has the following
GL Div-Dept Amt
7586 10-14 $10.00
7586 10-12 $ 5.00
SubFormPaymentRequest2 should only show
GL Div-Dept Amt
7586 10-14 $30.00
7586 10-12 $ 5.00
I suspect this would require code with an "And" statement built in the
AfterUpdate event of the Amount Field in SubFormPaymentRequest1, however I
have no idea how to build this statement as I am not very familiar with
Access coding. If anyone is willing to help me, I would appreciate it very
much.
Thanks
Valerie
**PaymentRequestFrm--based upon RequestTbl--general information regarding
the payment request.
**SubFormPaymentRequest1--continuous form based upon DistributeQrySub1--SQL
view below
SELECT DistributionTbl.DistributionNumber, DistributionTbl.RequestNumber,
DistributionTbl.GLNumber, DistributionTbl.[Div-Dept],
DistributionTbl.DistributionAmount, BudgetTbl.BudgetAmount,
DistributionTbl!GLNumber & "-" & DistributionTbl![Div-Dept] AS
AccountNumber, IIf([Div-Dept] Is Null,1,0) AS ErrCk
FROM DistributionTbl LEFT JOIN BudgetTbl ON (DistributionTbl.GLNumber =
BudgetTbl.GLNumber) AND (DistributionTbl.[Div-Dept] =
BudgetTbl.DivisionDepartment);
**SubFormPaymentRequest2--continuous form based upon DistributeQrySub2 to
add up all DistributionAmounts for all Account Numbers--SQL view below
SELECT DistributeQryMain.GLNumber, DistributeQryMain.[Div-Dept],
DistributeQryMain.SumOfDistributionAmount, BudgetTbl.BudgetAmount,
[BudgetAmount]-[SumOfDistributionAmount] AS RemainingBudget
FROM (DivDeptTbl INNER JOIN DistributeQryMain ON DivDeptTbl.[Div-Dept] =
DistributeQryMain.[Div-Dept]) INNER JOIN BudgetTbl ON
(DistributeQryMain.GLNumber = BudgetTbl.GLNumber) AND (DivDeptTbl.[Div-Dept]
= BudgetTbl.DivisionDepartment)
GROUP BY DistributeQryMain.GLNumber, DistributeQryMain.[Div-Dept],
DistributeQryMain.SumOfDistributionAmount, BudgetTbl.BudgetAmount,
[BudgetAmount]-[SumOfDistributionAmount];
SQL for DistributeQryMain
SELECT DistributQrySub1.GLNumber, DistributQrySub1.[Div-Dept],
Sum(DistributQrySub1.DistributionAmount) AS SumOfDistributionAmount
FROM DistributQrySub1
GROUP BY DistributQrySub1.GLNumber, DistributQrySub1.[Div-Dept];
All queries, tables, and forms work like I need them to, except I need to
filter the DistributeQry2 for the SubFormPaymentRequest2 based upon the
GLNumber field and DivDept field in SubFormPaymentRequest1.
The PaymentRequestFrm has a total Amount Field and the
SubFormPaymentRequest1 can have a various number of lines that must equal
the total amount on the PaymentRequestFrm.
Example
SubFormPaymentRequest1 entered previously for Request #1 has the following
GL Div-Dept Amt
7586 10-14 $20.00
7502 10-12 $ 6.00
SubFormPaymentRequest1 for Request # 2 has the following
GL Div-Dept Amt
7586 10-14 $10.00
7586 10-12 $ 5.00
SubFormPaymentRequest2 should only show
GL Div-Dept Amt
7586 10-14 $30.00
7586 10-12 $ 5.00
I suspect this would require code with an "And" statement built in the
AfterUpdate event of the Amount Field in SubFormPaymentRequest1, however I
have no idea how to build this statement as I am not very familiar with
Access coding. If anyone is willing to help me, I would appreciate it very
much.
Thanks
Valerie