Custom Delete Message

JaredNJames

Registered User.
Local time
Today, 23:56
Joined
Jul 7, 2007
Messages
87
Hi, im looking for a generic delete code to use with my systems.

Basically;

User presses command button,
Access asks whether they want to delete record (with a custom yes/no msgbox as opposed to the built in access one)?

then
if yes, record is deleted and a message saying "record deleted".
or
if no, delete action cancelled.

i do not want the default access messages to appear, but my own custom messages.
e.g. msgbox("Record Deleted"),vbinformation

i do not know how to use the yes/no msgbox so cannot even begin to attempt this code. and before anyone says it, searching these databases for the words like "delete" do not find anything like it.

any help appreciated,

jared james
 
Have you tried using the Command Button wizard to create a "Delete Record" button to see what code is generated?
 
Well of course, but with access 2007 i cannot for the life of me find out how to view the macro code that is created. it uses a macro but you cant view the code.

lhowever, that is irrelevant, ike i said though, the macro for that particular button would use access standard messages which i do not like.

and so, that also doesnt tell me how to use the yes/no msgbox system to run the delete code.

dont want to be too nasty here, but you really havent done anything in the way of helping. just told me how to make a button through access which would run in the same way as my current delete buttons, with the same messages.
(current delete buttons use only the delete code so access uses standard messages).

jared james
 
well **i** don't want to be rude, JaredNJames but RuralGuy was just giving a suggestion, not claiming to be the cure for cancer. if you want help, you have to be a little nicer to people on this *free* forum where people *voluntarily* give their expertise.

i for one have wanted to do the same thing, and i found my anwser in these forums by doing the correct searches, instead of insulting people with a useless post with a boring question that has been covered before many times.

give the people on here some respect and go look for a solution first before biting the hand that feeds you.
 
Its in the help file of access so I am copying this code for you with a little ammendement

'*******************************************************************

Private Sub Form_BeforeDelConfirm(Cancel As Integer, _
Response As Integer)
' Suppress default Delete Confirm dialog box.
Response = acDataErrContinue
' Display custom dialog box.(you can replace it with any message you want)
If MsgBox("Do you want to delete this entry?", vbOKCancel) = vbCancel Then
Cancel = True
End If
End Sub

Private Sub Form_AfterDelConfirm(Status As Integer)
Select Case Status
Case acDeleteOK
MsgBox "Deletion occurred normally."
Case acDeleteCancel
MsgBox "Programmer canceled the deletion."
Case acDeleteUserCancel
MsgBox "User canceled the deletion."
End Select
End Sub

'*****************************************************************
paste these two events in your form's code


Khawar
 

Users who are viewing this thread

Back
Top Bottom