I'm currently using Farpoint's Spread 3 control, which displays spreadsheets based on queries, allowing you to more easily navigate the data, export to excel, and of course update and delete as necessary.
My problem, however, is understanding how to delete the row which the user selects in the spreadsheet. In a test project, my code looks like this when the 'Delete' command button is clicked:
===========================
Private Sub cmdDelete_Click()
Dim strCnn As New ADODB.Connection
Dim Cnn1
Dim rsTop As ADODB.Recordset
Set cmd = New ADODB.Command
'Open ADO Connection
'See Globals
strCnn = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=MER191DB_TEST;Data Source=WBIHO-78HFDMB"
Set Cnn1 = New ADODB.Connection
Cnn1.Open strCnn
'Defines recordset for top-most portion of form
Set rsTop = New ADODB.Recordset
rsTop.Open "Bond", Cnn1, adOpenKeyset, adLockOptimistic, adCmdTable
Set cmd.ActiveConnection = Cnn1
cmd.CommandText = "DELETE FROM Bond WHERE Bond_number=' & Form1.fpSpread1.RowSel1 & '"
'Loop through rsTop recordset and populate corresponding text, check, and combo boxes
With rsTop
'Delete a row in the spreadsheet
Form1.fpSpread1.Action = SS_ACTION_DELETE_ROW
cmd.Execute
End With
End Sub
=============================
It is intended to clear the row from the current spreadsheet, while at the same time removing the respective row from the database, however I cannot figure out how to correctly link the selected row to the data in the table being deleted.