OpenConn()
     Dim li As Integer
     Dim qqttyy As Integer = Val(ListView1.Items(li.Index).SubItems(3).Text)
     Dim codee As String = ListView1.Items(li.Index).SubItems(1).Text
     OleDa.UpdateCommand.CommandText = "UPDATE Inventry SET QTY = QTY -'" & qqttyy & "'WHERE CODE ='" & codee & "'"
     OleDa.UpdateCommand.ExecuteNonQuery()
CloseConn()

Hi
I'm not 100% sure Access would support this but your query syntax is wrong anyway.
I assume field QTY is a numeric type i.e. not a string.

In your query you have encapsulated the qqttyy value in Single quotes i.e. your query says it is a string:

UPDATE Inventry SET QTY = QTY - ' " &qqtty &" ' WHERE CODE ='" &codee &"'"

i.e. say qqtty is 6 if the above was typed directly into access this is what you get:
UPDATE Inventry SET QTY = QTY -'6' WHERE Code='MyCode'

In otherwords, if QTY is a number you are trying to take the String value "6" from it.

Try dropping those single quotes so you will have:
UPDATE Inventry SET QTY = QTY - 6 WHERE Code='MyCode'

Not 100% sure it will work but at least you'll be subtracting numbers from numbers.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.