Hi expert,

I have the code to delete all entries in the datagrid but it seems it will not delete just in one click. Pls help me on this. Thanks

Private Sub cmdRefresh_Click()

Set rs = New ADODB.Recordset
rs.Open "select * from ItemPurchased", cn, adOpenStatic, adLockPessimistic

        Do While Not rs.EOF

        rs.Delete

        rs.MoveNext

        Loop

rs.Close
Set rs = Nothing
Member Avatar for dwirch

Why not use a little different delete command? Rather than selecting all the records, then looping the recordset deleting each record in turn, you could simply do this:

delete from ItemPurchased

Issue that command, and get rid of the loop. Be warned it will delete ALL records from the table.

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.