Subform Footer Textbox wont update

Local time
Today, 21:16
Joined
Feb 14, 2025
Messages
33
Screenshot2.jpg


Hi all
I have an orders main form with a 'cart' subform

The query behind the subform has a calculated field [LineTotal] which calculates QTY*RetailPrice for the subtotal 'Column' and then the textbox in the footer can also calculate an order total. When adding the records it calculates well.

Because I dont want the users to be able to change the price/qty for procedure reason, the fields in view are textboxes showing the actual field values. Should for example the price need to be changed, a double click on the price display brings up the yellow price adjustment form which once the new price is entered updates the correct field in the cart subform. As wanted the line subtotal changes correctly, but the Order total on the subform footer does not.

I have tried to add to the vba confirm button both me.requery and me.refesh, and also tried to add either to the after change and after update events but nothing automatically updates the textbox calculation.

If I press on another product line, or leave and re=enter the new total is shown. I know I should either move to another record or save the record to force access to recalculate and I do have docomd.save as the next line in my vba to set the new price from the adjustment form but whatever it is saving, it is not that record.

Any ideas what I am doing wrong.

Thanks
Chris
 
and I do have docomd.save
When you are unsure as what command to use, Google it. :(


Saving a record.
 
AH,
Code:
Private Sub PriceChange_Click()

Dim NewOne As Currency
    NewOne = [Forms]![PriceAdjustFM]![NewPrice]
    
    
        [Forms]![NewCustOrderMainFM]![CustOrderListSub]![RetailItemPrice] = NewOne
        
        DoCmd.Save
        
        
 
            [Forms]![NewCustOrderMainFM]![CustOrderListSub].SetFocus
 
            Me.Requery
            
 
 
 
 
 
 
 

        
End Sub

This is my code. I'm thinking maybe the UpdatePrice form is saving, and not the subform.

maybe I need to change the save command to ;
DoCmd.Save acForm, "Cartsubformname" ?
 
Code:
DoCmd.RunCommand acCmdSaveRecord
Me.Recalc

You will need to run this every time the Product or Qty gets updated.
 
HI
Thanks, I will try that.

Was also googling and another place was showing code to add a new record, forcing the record to save and then deleting the new record created,
seemed a long winded way to do it, although I get the logic
 
ok. I get that now, i have been thinking its saving the record.
Will saving the subform object also save the change made to the actual record
Well if it did, it would have done it with the code you had, would it not? :(
 
Your code is saving the popup, NOT the underlying record unless the popup is bound. In either case, the solution from the other post is to

1. make the popup model so the code will stop executing in the calling form when the popup opens
2. update the subform as you are currently doing in your posted code
3. On the line AFTER the OpenForm method, save the current record. That may update the calculation. If it doesn't, then add a Me.Refresh

DoCmd.RunCommand acCmdSaveRecord
Me.Refresh
 

Users who are viewing this thread

Back
Top Bottom