A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Custom message on delete



 
 
Thread Tools Display Modes
  #1  
Old June 25th, 2004, 09:00 PM
DD
external usenet poster
 
Posts: n/a
Default Custom message on delete

I have a command button on a form to delete and I would
like to add a custom delete confirmation (as opposed to
the "you are about to delete..." message. I need to know
the syntax to do that along with where it will be placed
in the code. Thanks in advance. Happy weekend all.

Here is my code:

Private Sub cmdDelete_Click()
On Error GoTo Err_cmdDelete_Click

DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdDeleteRecord

Exit_cmdDelete_Click:
Exit Sub

Err_cmdDelete_Click:
MsgBox Err.Description
Resume Exit_cmdDelete_Click

End Sub
  #2  
Old June 25th, 2004, 10:12 PM
Katrina
external usenet poster
 
Posts: n/a
Default Custom message on delete

For you form there is an event that fires when a record is deleted. "On
Delete" in the Form Properties under events.

Put a MSGBox in that even procedure...

Private Sub Form_Delete(Cancel As Integer)
dim myresp as integer
myresp = MSGBOX("Are you sure you want to delete the current Record?",
vbyesno, "Deletion Confirmation")
if myresp = vbno then
cancel = true
endif
End Sub


HTH
Kat
"DD" wrote in message
...
I have a command button on a form to delete and I would
like to add a custom delete confirmation (as opposed to
the "you are about to delete..." message. I need to know
the syntax to do that along with where it will be placed
in the code. Thanks in advance. Happy weekend all.

Here is my code:

Private Sub cmdDelete_Click()
On Error GoTo Err_cmdDelete_Click

DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdDeleteRecord

Exit_cmdDelete_Click:
Exit Sub

Err_cmdDelete_Click:
MsgBox Err.Description
Resume Exit_cmdDelete_Click

End Sub



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't delete message from Outbox Barry Brown General Discussion 14 June 9th, 2004 06:10 AM
I can't delete a message from my outbox Joey General Discussion 1 June 4th, 2004 04:31 AM
Cannnot delete an email message in inbox Andy General Discussion 2 June 3rd, 2004 04:52 PM
Macro Custom Buttons - How do I delete them Sheila Worksheet Functions 5 June 1st, 2004 02:40 PM
quick delete e-mail message Roy Outlook Express 1 May 30th, 2004 02:16 PM


All times are GMT +1. The time now is 11:42 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.