Dear All,
Thanks for a great forum, like the upgrade!
I have a problem deleting a records.
I have made my own message box to inform the user that they are deleting the record.
The problem is if they click Yes, another message box appears and says:
If the user chooses Yes, then it is fine and the record is deleted, with all linked records, great, exaclty what I want, except for the extra message box...
I could live with that, BUT, if the user then decides, oh no I don't want to delete the record, and clicks No.
The following error occurs:
This will serve to confuse users.
Is there a way to get rid of the secondary message box(below)?:
So I just have my MsgBox?
My code is below:
Your help is greatly appreciated!
Thanks you!
Thank you,
Kind regards
Triacona
Thanks for a great forum, like the upgrade!
I have a problem deleting a records.
I have made my own message box to inform the user that they are deleting the record.
The problem is if they click Yes, another message box appears and says:
Message Box said:Relationships that specify cascading deletes are about ot cause 1 record(s) in this table and in related tables to be deleted.
Are you sure you want to delete these records? - Yes No Help
If the user chooses Yes, then it is fine and the record is deleted, with all linked records, great, exaclty what I want, except for the extra message box...
I could live with that, BUT, if the user then decides, oh no I don't want to delete the record, and clicks No.
The following error occurs:
Run-time error '2501' said:The RunCommand action was canceled
This will serve to confuse users.
Is there a way to get rid of the secondary message box(below)?:
Message Box said:Relationships that specify cascading deletes are about ot cause 1 record(s) in this table and in related tables to be deleted.
Are you sure you want to delete these records? - Yes No Help
So I just have my MsgBox?
My code is below:
Code:
[COLOR=blue]Private Sub[/color] QuestDeleteEntire_Click()
[COLOR=blue]On Error GoTo[/color] Err_QuestDeleteEntire_Click
[COLOR=blue]If[/color] msgbox("Are you sure you want to delete this record?", vbYesNo, "DELETE RECORD!!") = vbYes [COLOR=blue]Then[/color]
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdDeleteRecord
[COLOR=blue]End If[/color]
Exit_QuestDeleteEntire_Click:
'Me.[Forms.QuestionnaireFormClose].Requery
[COLOR=blue]Exit Sub[/color]
Err_QuestDeleteEntire_Click:
[COLOR=blue]If[/color] Err.Number = 2501 [COLOR=blue]Then[/color]
msgbox "Record not deleted"
[COLOR=blue] Else[/color]
msgbox Err.Description
[COLOR=blue]End If[/color]
[COLOR=blue]Resume[/color] Exit_QuestDeleteEntire_Click
[COLOR=blue]End Sub[/color]
Thanks you!
Thank you,
Kind regards
Triacona