Hello!
I am makeing inventry program for my SHOP,
When Button1 clicked, listview all items will UPDATE, listview coloum 3(QUANTITY) will SUBTRACT from ms access quantity.
Please help me.

Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click



        Try

            Call OpenConnection()




            OleDa.UpdateCommand.Parameters.Add("UPDATE [Inventry] SET [QTY] = [QTY] - " & Me.ListView1.Items(0).SubItems(3).Text & " WHERE [Item Code] =" & Me.ListView1.Items(0).Text)



            Call CloseConnection()
            MsgBox("Record(s) has been Updated...", MsgBoxStyle.Information, "Record(s) Updated...")

        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Error...")
        End Try





    End Sub

If the quantity is an auto number, it will not be changeable.

Other than that, just wrap your values that are strings in the correct casts or 's.

Example:

'If quant is an int the listview try
Cint(Me.ListView1.Items(0).SubItems(3).Text)

'Or

OleDa.UpdateCommand.Parameters.Add("UPDATE [Inventry] SET [QTY] = [QTY] - '" & Me.ListView1.Items(0).SubItems(3).Text & "' WHERE [Item Code] ='" & Me.ListView1.Items(0).Text & "'")
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.