0

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
2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by Begginnerdev
0

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 & "'")
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.