How can I do that ? Could you give a code example please.
Thanks
Ok, but I will be making many assumptions about your data strategy.
Assuming each record on the grid has a primary key (or something to uniquely identifiy that record),
when the user chooses to delete THAT record, send the records primary key to this function:
-
Public Sub DeleteRecord(PrimaryKeyValue as String)
-
Dim sSql As String
-
sSql = "DELETE FROM myTable WHERE PrimaryKeyField = '" & PrimaryKeyValue & "'"
-
adoCon1.Execute sSql
-
End Sub
-
Then, refresh grid assuming it was binded to a ADODB recordset object:
-
Public Sub RefreshGrid()
-
Dim rs As Adodb.Recordset
-
Set rs = fgData.DataSource
-
rs.Requery
-
Set fgData.DataSource = rs
-
End Sub
-
The assumptions I made were:
1. You have a global adodb.connection object called adoCon1
2. adoCon1 is established and ready to do work.
3. Your grid is bound to an ADODB recordset object.
Hopefully, your actual setup is not much different. But if it is, pay more attention to the concept of deleting the record using primary key and resetting your grid from the datasource.