Re: Duplicate Record with .ADDNEW




<mamin@xxxxxxxxxxxxxxxxx> wrote in message
news:1163162480.339497.240000@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi,
Lately I am having very strange issue with my code and not sure what is
causig issue.

I have following code which creates new entry in table

===========================================
rsOrderItems.open "tblOrderItems", ConnOrder, adOpenStatic,
adLockOptimistic
rsOrderItems.AddNew
rsOrderItems("OrderId") = pOrderID
rsOrderItems("ProductID") = arrAmazonStoreCart(i, 0)
rsOrderItems("PricePerUnit") = (arrAmazonStoreCart(i, 2) /
arrAmazonStoreCart(i, 1)) 'Line Item total/Qty
rsOrderItems("Qty") = arrAmazonStoreCart(i, 1)
rsOrderItems("Giftwrap") = arrAmazonStoreCart(i, 3)
rsOrderItems("AmazonOrderItemCode") = arrAmazonStoreCart(i, 7)

If Trim(arrAmazonStoreCart(i, 8)) <> "" Then
rsOrderItems("GiftWrapType") = arrAmazonStoreCart(i, 8)

End If

rsOrderItems.Update

rsOrderItems.MoveLast
pOrderItemsID = rsOrderItems("orderitemsid")
rsOrderItems.Close
==============================================
Some times it will create same entry twice. I have been debugging this
issue for two days not able to find out. My best assumption is
happening in above code. If I do the same thing manually it does not
happen so I am not able to recreate issue. However it is keep happening
at least 5 to 10 times a day. This is occasional

Please let me know if anyone had this type of situation before

Thanks


How are you calling the routine? If you are calling it via KeyDown,
Keypress, Click events of any control then watch it...


.



Relevant Pages

  • Re: Duplicate Record with .ADDNEW
    ... users have not duplicated entries. ... rsOrderItems= pOrderID ... Some times it will create same entry twice. ... If you are calling it via KeyDown, ...
    (microsoft.public.vb.database.ado)
  • Re: Duplicate Record with .ADDNEW
    ... duplicate entry..when two same items being ordered... ... rsOrderItems= pOrderID ... Some times it will create same entry twice. ... If you are calling it via KeyDown, ...
    (microsoft.public.vb.database.ado)
  • Re: Duplicate Record with .ADDNEW
    ... Lately I am having very strange issue with my code and not sure what is ... causig issue. ... rsOrderItems= pOrderID ... Some times it will create same entry twice. ...
    (microsoft.public.vb.database.ado)
  • Re: Duplicate Record with .ADDNEW
    ... Lately I am having very strange issue with my code and not sure what is ... causig issue. ... rsOrderItems= pOrderID ... Some times it will create same entry twice. ...
    (microsoft.public.vb.database.ado)

Loading