Private Sub cmddelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmddelete.Click

    If Not acsconn.State = ConnectionState.Open Then
        acsconn.Open()
    End If
    'sql statements
    strSQL = "DELECT * FROM Table1 ([Item Code], [Item], [Sale Price], [Purchase Price]) values ('" _
    & txtid.Text & "','" _
    & txtname.Text & "','" _
    & txtaddress.Text & "','" _
    & txtage.Text & "')"
    Dim acscmd As New Data.OleDb.OleDbCommand ' the oledbcommand
    acscmd.CommandText = strSQL 'sets the sql string
    acscmd.Connection = acsconn 'sets the connection to use the oledbcommand
    acscmd.ExecuteNonQuery() ' execute oledb commands non query only
    acscmd.Dispose()
    MsgBox("deleted")
    acsconn.Close()

End Sub

Your Sql string is wrong it looks like a mishmash of a SELECT and an INSERT Statement

If you wish to DELETE Something the Syntax is as follows:

DELETE FROM Table WHERE 'Conditions go here

If you do not specify any conditions, you will wipe the whole table.

I try this :

Private Sub cmddelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmddelete.Click
        If Not acsconn.State = ConnectionState.Open Then
            acsconn.Open()
        End If
        'sql statements
        strSQL = "DELETE FROM Table1 WHERE ([Item Code], [Item], [Sale Price], [Purchase Price]) values ('" _
        & txtid.Text & "','" _
        & txtname.Text & "','" _
        & txtaddress.Text & "','" _
        & txtage.Text & "')"
        Dim acscmd As New Data.OleDb.OleDbCommand ' the oledbcommand
        acscmd.CommandText = strSQL 'sets the sql string
        acscmd.Connection = acsconn 'sets the connection to use the oledbcommand
        acscmd.ExecuteNonQuery() ' execute oledb commands non query only
        acscmd.Dispose()
        MsgBox("deleted")
        acsconn.Close()
    End Sub

but its show this :

Syntax error (missing operator) in query expression '([Item Code], [Item], [Sale Price], [Purchase Price]) values ('1251','sdfdf','11','11')'.
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.