I keep getting this error & don't know how to handle it
this is my code:
----------------------------------------------
Private Sub cmdDelete_Click()
Dim con As Object
Dim stSql1 As String
Dim stSql2 As String
Dim stSql3 As String
Dim stSql4 As String
stSql1 = "UPDATE tblBudget SET Budget ='" & Me!Budget & "' + '" & Me!totalamount & "' WHERE CustomerId =" & Me!CustomerId
con.Execute (stSql4)
Set con = Application.CurrentProject.Connection
stSql2 = "UPDATE tblProductes INNER JOIN tblOrderlines ON tblProducts.ProductId = tblOrderlines.ProductId SET AmountInSupply = (AmountInSupply + LastAmount) WHERE tblOrderlines.OrderId =" & Me!OrderId
DoCmd.SetWarnings False
'Delete the order with its orderlines
stSql3 = "DELETE * FROM tblOrderlines where OrderId =" & Me!OrderId
stSql4 = "DELETE * FROM tblOrders where OrderId =" & Me!OrderId
DoCmd.SetWarnings True
Me.Refresh
con.Execute (stSql1)
con.Execute (stSql2)
con.Execute (stSql3)
DoCmd.Close
End Sub
-----------------------------------
I get the error while trying to update the table tblBudget.
As an order is cancelled by pressing the button cmdDelete, the budget of the customer has to be increased again with the total amount of the order(cfr. stSql1), but that's were something keeps going wrong.
Any idea why? Thanks a lot in advance,
dj.
this is my code:
----------------------------------------------
Private Sub cmdDelete_Click()
Dim con As Object
Dim stSql1 As String
Dim stSql2 As String
Dim stSql3 As String
Dim stSql4 As String
stSql1 = "UPDATE tblBudget SET Budget ='" & Me!Budget & "' + '" & Me!totalamount & "' WHERE CustomerId =" & Me!CustomerId
con.Execute (stSql4)
Set con = Application.CurrentProject.Connection
stSql2 = "UPDATE tblProductes INNER JOIN tblOrderlines ON tblProducts.ProductId = tblOrderlines.ProductId SET AmountInSupply = (AmountInSupply + LastAmount) WHERE tblOrderlines.OrderId =" & Me!OrderId
DoCmd.SetWarnings False
'Delete the order with its orderlines
stSql3 = "DELETE * FROM tblOrderlines where OrderId =" & Me!OrderId
stSql4 = "DELETE * FROM tblOrders where OrderId =" & Me!OrderId
DoCmd.SetWarnings True
Me.Refresh
con.Execute (stSql1)
con.Execute (stSql2)
con.Execute (stSql3)
DoCmd.Close
End Sub
-----------------------------------
I get the error while trying to update the table tblBudget.
As an order is cancelled by pressing the button cmdDelete, the budget of the customer has to be increased again with the total amount of the order(cfr. stSql1), but that's were something keeps going wrong.
Any idea why? Thanks a lot in advance,
dj.