Results 1 to 4 of 4
  1. #1
    Girraffa is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Posts
    32

    Question Delete button for records in a continuous report

    Folks,
    Happy Friday! (or whatever day it is for you...)
    I have a report with a detail section that shows data for one record, for example for a procedure that was performed. When you open the report you have a series of detail sections each showing the data for a different procedure. At the bottom of the detail section there are buttons for "menu" (opens the menu which is a switchboard form I made) "delete record" (which has code to delete the record, below), and a "close" button (closes the report and opens the menu). I just started wondering...if my (one) user chooses "delete" and confirms their selection...will it delete just that record or will it delete all records for all procedures showing in the report?
    <Code>
    Private Sub cmdDelete_Click()
    Dim lResponse As Long


    Dim sPrompt As String
    On Error GoTo ErrHandler
    sPrompt = "Are you sure you want to delete this record?"
    lResponse = MsgBox(sPrompt, vbQuestion + vbYesNo, "DeleteRecord")
    If lResponse = vbYes Then
    DoCmd.RunCommand acCmdSelectRecord
    DoCmd.RunCommand acCmdDeleteRecord
    End If
    ErrExit:
    Exit Sub
    ErrHandler:
    MsgBox "Error is " & Err.Description
    Resume ErrExit
    End Sub
    Private Sub Form_BeforeDelConfirm(Cancel As Integer, Response As Integer)
    ' Suppress default Delete Confirm dialog box because I made my own for cmdDelete
    Response = acDataErrContinue
    End Sub
    </Code>
    Thanks for your help!

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Testing should reveal the answer; looks like it should just delete the record.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Girraffa is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Posts
    32
    Quote Originally Posted by pbaldy View Post
    Testing should reveal the answer; looks like it should just delete the record.
    Great, thank you!

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 07-12-2017, 11:45 PM
  2. Replies: 21
    Last Post: 10-13-2016, 03:29 PM
  3. Continuous Form - Delete Selected Records
    By soco3594 in forum Forms
    Replies: 9
    Last Post: 01-20-2016, 02:31 PM
  4. Replies: 6
    Last Post: 07-11-2012, 10:13 PM
  5. Button on form to delete all records
    By bbylls in forum Forms
    Replies: 2
    Last Post: 12-08-2009, 12:38 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums