Hi everyone,
I am having a bit of problem here,
I have a sub form which listed all the calculated equipment cost
For this I created a query to sum up all the cost field in the sub form
I want to show the sum of those field on the Main form? As the control source of the main form is a table called Job so I can't show the query.
Can anyone help please! I have tried to put the following code in the after update section of subform but it doesn't work Forms![Main]![Text200] = Query![Query1]![SumOfCost]
SQL for sumofcost is as below
SELECT Sum(ElectricalDetails.Cost) AS SumOfCost, First(Job.JobNum) AS FirstOfJobNum
FROM Job INNER JOIN ElectricalDetails ON Job.JobNum = ElectricalDetails.JobNum
HAVING ((([ElectricalDetails]![JobNum])=[Job]![JobNum]));
I have tested SQL and it work fine, just the matter of displaying it on the main form
I have also tried another way of adding the following code on the control source of the text box on the main form
=DSum("[Cost]", "[ElectricalDetails]", "[JobNum] = " & Me.JobNum)
But it doesn't seems to work either
Can anyone help please!
Si
I am having a bit of problem here,
I have a sub form which listed all the calculated equipment cost
For this I created a query to sum up all the cost field in the sub form
I want to show the sum of those field on the Main form? As the control source of the main form is a table called Job so I can't show the query.
Can anyone help please! I have tried to put the following code in the after update section of subform but it doesn't work Forms![Main]![Text200] = Query![Query1]![SumOfCost]
SQL for sumofcost is as below
SELECT Sum(ElectricalDetails.Cost) AS SumOfCost, First(Job.JobNum) AS FirstOfJobNum
FROM Job INNER JOIN ElectricalDetails ON Job.JobNum = ElectricalDetails.JobNum
HAVING ((([ElectricalDetails]![JobNum])=[Job]![JobNum]));
I have tested SQL and it work fine, just the matter of displaying it on the main form
I have also tried another way of adding the following code on the control source of the text box on the main form
=DSum("[Cost]", "[ElectricalDetails]", "[JobNum] = " & Me.JobNum)
But it doesn't seems to work either
Can anyone help please!
Si