Combo box error message After_Update

TIbbs

Registered User.
Local time
Today, 13:45
Joined
Jun 3, 2008
Messages
60
I have a form that I am entering data in the following fields:
SKU | Qty | Description | UnitPrice | DiscountRate | CustomerID

The user enters the sku and Qty, the system checks for errors and returns the Description if values are found. The user then needs to enter a discount rate to be applied to each line.
The discount field is a combo box which holds 3 value lists: 10, 12.5 and 15.
This refers to the DiscountRate Field. I want to update all the values in that column with the value selected in the first row of that column.
So I set up an After_Update event in which an update query is run for the field, taking into consideration the first row value entered in the combobox.

Code:
Private Sub DiscountRate_AfterUpdate()
Dim sCriteria As String

sCriteria = "UPDATE tblSOPScratchPad " & _
"SET tblSOPScratchPad.DiscountRate =" & DiscountRate.Value & ";"
   
   
   CurrentDb.Execute sCriteria
   Me.DiscountRate.Requery
   
End Sub

Problem is when I navigate to the second record a error message is displayed:

Write Conflict
This record has been changed by another user since you started editing. If you save the record, you will overwrite the changes the other user made.

It then gives me an option to Save Record, Copy to Clipboard or Drop Changes.

How can I cancel that error message?
Is there a better way to implement this?
 
:p I feel such a fool, I sorted it out now...
Too many hours peering through it and I think my brain was fried.
I put the form as a subquery and created on the master page an unbound combo box with the values, after that I apply the discount on combo box 1, which replicates the value in combo box 2, without the error message.

here is the code if anyone needs it as a reference:

Code:
Private Sub cboApplyDiscount_AfterUpdate()
 Dim sCriteria As String

sCriteria = "UPDATE tblSOPScratchPad " & _
"SET tblSOPScratchPad.DiscountRate =" & cboApplyDiscount.Value & ";"
CurrentDb.Execute sCriteria
Me.frmSOPScratchPad.Form![DiscountRate].Requery
   

End Sub
 

Users who are viewing this thread

Back
Top Bottom