Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculation in Form Makes Every Order Amount Same

Status
Not open for further replies.

bsarman

Technical User
Feb 10, 2003
73
0
0
US
I have an order form where the changes in one record applies to every record. What do I need to do so if I update one record that update is just for that record not all the records in the form?
The fields I have are:
Subscription Code: (combo1, Unbound). Rep selects a record in here which creates a related drop down box on the next combo box.
Subscription Def: (combo3, Unbound). Rep selects a product from drop down.
Price: (combo7, Unbound). Price related to combo3 appears in combo7. Rep selects price.
Quantity: (Unbound)
Discount: (Unbound)
DiscountAmount: (Unbound). Discount/100
OrderAmount: (Unbound)

Here’s the code I wrote. Please help me figure out what I’m doing wrong. THANKS.

Private Sub Combo1_AfterUpdate()
OrderAmount.Value = (Nz(Me.Combo7 * Quantity)) - (Nz(Me.Combo7) * Quantity * DiscountAmount)

Me!Combo3 = Null
Me!Combo3.Requery
Me!Combo7 = Null
Me!Combo7.Requery
End Sub
Private Sub Combo3_AfterUpdate()
OrderAmount.Value = (Nz(Me.Combo7 * Quantity)) - (Nz(Me.Combo7) * Quantity * DiscountAmount)
End Sub
Private Sub Combo3_Change()
Me!Combo7 = Null
Me!Combo7.Requery
End Sub
Private Sub Combo7_AfterUpdate()
OrderAmount.Value = (Nz(Me.Combo7 * Quantity)) - (Nz(Me.Combo7) * Quantity * DiscountAmount)
End Sub
Private Sub Discount_AfterUpdate()
OrderAmount.Value = (Nz(Me.Combo7 * Quantity)) - (Nz(Me.Combo7) * Quantity * DiscountAmount)
End Sub
Private Sub DiscountAmount_Change()
OrderAmount.Value = (Nz(Me.Combo7 * Quantity)) - (Nz(Me.Combo7) * Quantity * DiscountAmount)
End Sub
Private Sub Quantity_AfterUpdate()
OrderAmount.Value = (Nz(Me.Combo7 * Quantity)) - (Nz(Me.Combo7) * Quantity * DiscountAmount)
End Sub

 
I think some info is missing here.
Based on what you have posted, there are no records being created or updated, as all the fields are unbound.
 
They are being updated. However when there's an update it does it for every single order not just that current order. It's something to do with the calculation code being applied to somewhere else, or somewhere additional in one of the forms events.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top