I have these two text fields Quantity1 and Textstore. When someone clicks the button I want to feed the Storage function with the values entered in the text fields.
With this function I access two tables. However, there is a problem with the Insert into statement. It does not recognize the VALUES. Whenever I execute, a parameter question comes up for the three values.
I have already checked if the variables contain values, and they do.
What am I doing wrong ?
With this function I access two tables. However, there is a problem with the Insert into statement. It does not recognize the VALUES. Whenever I execute, a parameter question comes up for the three values.
I have already checked if the variables contain values, and they do.
What am I doing wrong ?
Code:
Private Sub Store_Click()
Dim Itemnumber As Integer
Dim Changeamount As Integer
Changeamount = Quantity1.Value
Itemnumber = Textstore.Value
Storage Changeamount, Itemnumber
End Sub
Code:
Private Sub Storage(Changeamount As Integer, Itemnumber As Integer)
Dim Quantity As Integer
Quantity = DLookup("Quantity", "Item", "Itemnumber=" & Itemnumber)
DoCmd.RunSQL "UPDATE item SET quantity=" & quantity + Changeamount & " WHERE Itemnumber=" & Itemnumber
DoCmd.RunSQL "INSERT INTO Goodsmovement(Itemnumber, Quantity, Quantitychange, [type of change])VALUES(Itemnumber, Quantity, Changeamount, 'Store')"
End Sub
Last edited: