A
andrew
Hi
I am having problems with totals from a subform. I am using 2 text boxes in
the footer of the subform to update values on the main form. It works fine
until there are 8 or more records in the subform. Once this number is
reached the 2 text boxes in the subform no longer contain a value and the
main form is not updated. However if the last record in the subform is
updated, 1 of the values is updated on the main form but the other is not.
Can anyone explain why this is happening and what to do about it?
The 2 boxes in the subform footer contain these expressions (it seems this
is not working once there are 8 records in the subform):
=Sum([TotalCost])
=Sum([TotalSale])
This function updates text boxes on the parent form (called by AfterUpdate
events on controls in the sub form):
Private Function funEquipmentValuesUpdate()
'Updates text boxes on parent form
' Requery to refresh the values in this form
Me.Requery
' Update Cost Price and Sale Price values in frmEquipment
Me.Parent.txtCostPrice = Me.txtCostTotal
Me.Parent.txtSalePrice = Me.txtSaleTotal + Me.Parent.txtAdjustment
Me.Parent.Dirty = False ' ensure form data is saved
End Function
This query is the record source for the sub form:
SELECT
ED.lngEquipmentID,
ED.lngEquipmentID2,
ED.sngQty,
E.strDescription,
E.strStockNo,
C.strCo,
ED.ysnDataType,
E.curCostPrice * ED.sngQty AS TotalCost,
E.curAdjustment * ED.sngQty AS TotalAdjustment,
E.curSalePrice * ED.sngQty AS TotalSale,
(E.curSalePrice - E.curAdjustment) * ED.sngQty AS TotalSalePreAdjust
FROM (
tblEquipmentDetails ED
INNER JOIN tblEquipment E
ON ED.lngEquipmentID2 = E.lngEquipmentID)
INNER JOIN tblCo C
ON E.lngCoID = C.lngCoID
WHERE ED.ysnDataType=Yes;
Thanks for your help.
Andrew
I am having problems with totals from a subform. I am using 2 text boxes in
the footer of the subform to update values on the main form. It works fine
until there are 8 or more records in the subform. Once this number is
reached the 2 text boxes in the subform no longer contain a value and the
main form is not updated. However if the last record in the subform is
updated, 1 of the values is updated on the main form but the other is not.
Can anyone explain why this is happening and what to do about it?
The 2 boxes in the subform footer contain these expressions (it seems this
is not working once there are 8 records in the subform):
=Sum([TotalCost])
=Sum([TotalSale])
This function updates text boxes on the parent form (called by AfterUpdate
events on controls in the sub form):
Private Function funEquipmentValuesUpdate()
'Updates text boxes on parent form
' Requery to refresh the values in this form
Me.Requery
' Update Cost Price and Sale Price values in frmEquipment
Me.Parent.txtCostPrice = Me.txtCostTotal
Me.Parent.txtSalePrice = Me.txtSaleTotal + Me.Parent.txtAdjustment
Me.Parent.Dirty = False ' ensure form data is saved
End Function
This query is the record source for the sub form:
SELECT
ED.lngEquipmentID,
ED.lngEquipmentID2,
ED.sngQty,
E.strDescription,
E.strStockNo,
C.strCo,
ED.ysnDataType,
E.curCostPrice * ED.sngQty AS TotalCost,
E.curAdjustment * ED.sngQty AS TotalAdjustment,
E.curSalePrice * ED.sngQty AS TotalSale,
(E.curSalePrice - E.curAdjustment) * ED.sngQty AS TotalSalePreAdjust
FROM (
tblEquipmentDetails ED
INNER JOIN tblEquipment E
ON ED.lngEquipmentID2 = E.lngEquipmentID)
INNER JOIN tblCo C
ON E.lngCoID = C.lngCoID
WHERE ED.ysnDataType=Yes;
Thanks for your help.
Andrew