wrote in message
> [posted earlier in other group]
>
> Hi All,
>
> I'm using the following code to delete one or more records from a DAO
> recordset.
> The code is working but I was wondering if I need to Update the
> recordset with:
>
> rsDel.Update?
>
> Public Function DelRecs(Lstview As ListView, sEntity As String, sID As
> String)
>
> Dim I As Integer
> Dim numSelected As Long
> Dim itmX As ListItem
> Dim rsDel As DAO.Recordset
> Dim intResponse As Integer
>
> Set rsDel = dbfASIC.OpenRecordset(sEntity, dbOpenDynaset)
> numSelected = SendMessage(Lstview.hwnd, LVM_GETSELECTEDCOUNT, 0&, ByVal
> 0&)
>
> If numSelected = 0 Then Exit Function
>
> If numSelected > 0 Then
> intResponse = MsgBox("Are you sure you want" & Chr$(13) & _
> "to remove " & numSelected & " record(s)?", vbYesNo,
> "Warning")
> If intResponse = vbYes Then
> For I = 1 To Lstview.ListItems.Count
> If Lstview.ListItems(I).Selected Then
> Lstview.ListItems(I).Selected = True
> Set itmX = Lstview.SelectedItem
> rsDel.FindFirst sID & " = " & Mid(itmX.Key, 2)
> rsDel.Delete
> End If
> Next I
> Call RemoveUnUsedLinks(sEntity, str(Mid(itmX.Key, 2)))
> End If
> End If
>
> End Function
>
> Marco
>
NO!
Do not call Update. You call it for AddNew and Edit, but never delete.
-ralph
>> Stay informed about: Deleting records from DAO recordset