Results 1 to 5 of 5
  1. #1
    shod90 is offline Competent Performer
    Windows 8 Access 2016
    Join Date
    Jan 2016
    Posts
    134

    disable disappearing a record while deleting it

    Dear Gents,
    Is there a way to disable disappearing records temporary when i press delete button ?
    if i pressed yes delete , then it will be deleted , But if i said don't delete it will restore that record again.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    No.
    once you delete a record its gone. That's why they call it delete.

    You could add a field DELETED. Put a button on the form,a 'delete' button ,to mark the record as true, and doesn't show.
    disable the delete record property on the form.
    then to 'undelete', set the deleted field to false.

  3. #3
    Micron is offline Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    Or are you asking for a delete confirmation before the delete?
    if i pressed yes delete , then it will be deleted
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Like this
    Code:
    Private Sub Form_BeforeDelConfirm(Cancel As Integer, Response As Integer)
    
    Response = MsgBox("Do You Want To Delete This Record?", vbCritical + vbYesNo, "You Are About To Delete a Record!")
    
    If Response = vbNo Then
      Cancel = True
    End If
    
    End Sub

    Linq ;0)>

  5. #5
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,511
    I think what he is asking is when you hit delete, it removes the record from view while it asks if you want to delete it. I think he wants to keep it visible until you hit yes/no to delete? If so I think use Missing code and just put an Else Delete command?

    Private Sub MyDeleteButton_OnClick(Cancel As Integer, Response As Integer)
    Response = MsgBox("Do You Want To Delete This Record?", vbCritical + vbYesNo, "You Are About To Delete a Record!")

    If Response = vbNo Then
    Cancel = True
    Else
    DoCmd.SetWarnings False
    DoCmd.RunCommand acCmdDeleteRecord
    DoCmd.SetWarnings True
    End If

    End Sub

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

Similar Threads

  1. Deleting current record using VBA
    By Kivan in forum Programming
    Replies: 3
    Last Post: 08-07-2012, 11:31 AM
  2. Older record disappearing when filtered
    By yohansetiawan in forum Access
    Replies: 4
    Last Post: 03-25-2012, 11:56 PM
  3. Deleting a record
    By alexc333 in forum Access
    Replies: 7
    Last Post: 07-26-2011, 10:43 AM
  4. Error when deleting a record
    By access in forum Forms
    Replies: 5
    Last Post: 06-15-2009, 12:33 PM
  5. Deleting Record Contents, not complete record...
    By Charles Waters in forum Access
    Replies: 2
    Last Post: 06-24-2008, 12:00 PM

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