Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is it possible to not show next record when deleting current?

Status
Not open for further replies.

sohunter

Technical User
Dec 3, 2001
106
0
0
US
When a user is in a form with multiple records, I realize that Access always moves to the next record when it's in the process of deleting one. So user gets the "are you sure you want to delete?" message in front of another record, which has always been sort of a flaw in my opinion. During that moment when user is confirming delete, I'd like user to see 1: the record they're deleting (I'm guessing this isn't possible because it's already been sent to the delete holding tank so to speak) or 2: show a blank record, and then once delete is confirmed, take them to the next record.

I'm currently just using the following code for the delete action:

Code:
    DoCmd.DoMenuItem acFormBar, acEditMenu, acSelectRecord, , acMenuVer70
    
     DoCmd.DoMenuItem acFormBar, acEditMenu, acDelete, , acMenuVer70

Any thoughts?

 
Hi,

it can be done. If you want to go to a new record after deleting a record, use this code in the same event:


DoCmd.RunCommand acCmdDeleteRecord
DoCmd.GoToRecord acActiveDataObject, , acNewRec
(only for access 2000)

Access 97:

:

DoCmd.DoMenuItem acFormBar, acEditMenu, acSelectRecord, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, acDelete, , acMenuVer70
docmd.gotorecord ,,acNewRec

regards Roltrap
 
Thanks, however my problem still isn't solved. I'm talking about before you've confirmed delete.... when the message box says "are you sure you want to delete this record?" It's at this point that the next record is showing on screen. (If you say No, it goes back to the record you were on.) Know what I mean?... I'm not talking about what needs to happen after I delete. hmmm....
 
I'm not a programmer so this may not suffice but it's what works for me. I use access 2000. To get around the same problem you're having in the BeforeDeleteConfirm event I placed Response = acDataErrContinue. Then in the Click event of my Delete Record command button I placed the folowing code:

Dim strNameToDelete As String
strNameToDelete = Me.sold_to_name

' Display custom dialog box.
If MsgBox("Delete " & strNameToDelete & "?", vbOKCancel + vbQuestion, "FCG Orders") = vbCancel Then
Cancel = True
Else
DoCmd.RunCommand acCmdDeleteRecord
End If

Hope that helps you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top