please help, i have a form where i enter goods recieved vouchers,in this form if the cost price on the form is higher than the price in the Stock table then the price must be updated, if the price is lower then the price in the stock table doesnt need to be updated.
I have a method which i have used before with no errors:
i run an if statement on my Lost Focus() event procedure on TxtCostPrice
it looks like this:
Sub txtCostPrice_LostFocus ()
Dim Cost1 As String
Dim Cost2 As String
Cost1 = txtCostPerUnit
Cost2 = DLookup("price", "Stock Numbers")
If Cost1 < Cost2 Then
Dim DocName As String
DocName = "updateIfCostPrice"
DoCmd OpenQuery DocName, A_NORMAL, A_EDIT
MsgBox "Cost price has been updated"
ElseIf Cost1 > Cost2 Then
MsgBox "Cost price does not need to be updated"
End If
End Sub
this code links me to my update query, everything on my update query looks fine but when i run the code it doesnt seem to be updating.
Please help as my deadline is fast approaching at an arlaming speed!
I have a method which i have used before with no errors:
i run an if statement on my Lost Focus() event procedure on TxtCostPrice
it looks like this:
Sub txtCostPrice_LostFocus ()
Dim Cost1 As String
Dim Cost2 As String
Cost1 = txtCostPerUnit
Cost2 = DLookup("price", "Stock Numbers")
If Cost1 < Cost2 Then
Dim DocName As String
DocName = "updateIfCostPrice"
DoCmd OpenQuery DocName, A_NORMAL, A_EDIT
MsgBox "Cost price has been updated"
ElseIf Cost1 > Cost2 Then
MsgBox "Cost price does not need to be updated"
End If
End Sub
this code links me to my update query, everything on my update query looks fine but when i run the code it doesnt seem to be updating.
Please help as my deadline is fast approaching at an arlaming speed!