Can anyone tell me ? how should i count the rows before delete the rows . when it come to the msgbox line it says item cannot be found in the recordset collection .or let me know any better way
Code:
Private Sub btDelete_Click()
Dim con As New ADODB.Connection
Dim Sqlcount As String
Dim Sql As String
Sqlcount = "Select Count(StoreID) From Inventory"
Sql = "DELETE FROM INVENTORY"
If Not OpenConnection(con) Then
Call MsgBox("Connection is not open", vbInformation, "Connectivity issue")
Exit Sub
End If
MsgBox con.Execute(Sqlcount).Fields("StoreID").Value
con.Execute "Delete from inventory"
con.Close
Set con = Nothing
Call MsgBox("Record deleted ", vbInformation)
End Sub