Updating OrderTotal field

davesmith202

Employee of Access World
Local time
Today, 22:50
Joined
Jul 20, 2001
Messages
522
I have frmOrders and fsubItems (as a subform on frmOrders).

When I pick an item from the combobox on the datasheet subform, it
populates description, price and total.

Then it attempts to store an OrderTotal value on the main form.

My code on the afterupdate event of the item combobox is...

Private Sub Product_AfterUpdate()
Description = Product.Column(1)
Price = Product.Column(2)
DoCmd.GoToControl "Units"
Total = Price * Qty
Forms!frmOrders!OrderTotal = Forms!frmOrders!OrderSubTotal +
Forms!frmOrders!Shipping + Forms!frmOrders!Tax
End Sub

Everything works ok except the updating of the OrderTotal. If I click
onto the main form and then alter the item combobox again, only then do I
see the OrderTotal updated.

Can I do something in code that will update this in real time? I wonder
if it is something to do with refreshing the record or something.

Thanks,

Dave
 
Add Me.Requery in the after update of your last text box although you have to cycle the current record if you don't want to move to a new record, the other option is to add a command button that saves the record.
HTH
 
Thanks Rich, but I don't want to use a Save button and when I use Me.Requery, it goes to the top item in the list on the subform.

Dave
 
Hi Dave

Have you tried Me.Refresh in the After_Update of the last text box?

HTH

Rich Gorvin
 
Excellent!

Me.Recalc did it. I didn't even know that existed!

Dave
 
Hi Rich

Hey, I like Me.Recalc!

Thanks for that one.

Rich Gorvin
 

Users who are viewing this thread

Back
Top Bottom