Delete confirmation message firing twice (1 Viewer)

AlefAelol

Registered User.
Local time
Today, 04:31
Joined
May 21, 2014
Messages
75
Hello everybody, what cause of delete confirmation message to appear twice? I'm trying to delete a record from subform of nested forms, but I got Cascade deletion to appear two times when I cancel the deletion, however, it appears once if I confirm the deletion process. Any help please ?
 

GinaWhipp

AWF VIP
Local time
Yesterday, 21:31
Joined
Jun 21, 2011
Messages
5,900
One way you can suppress the message...

Code:
DoCmd.SetWarnings False  'Before deletion
...
DoCmd.SetWarnings True 'After deletion

However, depending on *how* you are deleting the message the above may not work. So, please help us out by posting your deletion code\method.
 

AlefAelol

Registered User.
Local time
Today, 04:31
Joined
May 21, 2014
Messages
75
One way you can suppress the message...

Code:
DoCmd.SetWarnings False  'Before deletion
...
DoCmd.SetWarnings True 'After deletion
However, depending on *how* you are deleting the message the above may not work. So, please help us out by posting your deletion code\method.


Thank you for the replay. The deletion done by the delete button of the datasheet form, so no method used. However, I use the code below



Code:
Private Sub Form_BeforeDelConfirm(Cancel As Integer, Response As Integer)
 Response = acDataErrContinue

 If MsgBox("Are you sure you want to delete", vbOKCancel) = vbCancel Then
 Cancel = True
 End If

End Sub


Once I delete a record, a message of "OK Cancel" as in the code above appears, so if I hit cancel, the same message fires again, but if I hit OK, then the record be deleted and no message appears.
 

June7

AWF VIP
Local time
Yesterday, 17:31
Joined
Mar 9, 2014
Messages
5,466
What do you mean by "delete button of the datasheet form" - right click menu Delete?

Why use VBA and not just the intrinsic prompt for "Do you really want to delete?"?
 

GinaWhipp

AWF VIP
Local time
Yesterday, 21:31
Joined
Jun 21, 2011
Messages
5,900
Um, Delete button? What button? Please post exactly how you delete a record.
 

AlefAelol

Registered User.
Local time
Today, 04:31
Joined
May 21, 2014
Messages
75
What do you mean by "delete button of the datasheet form" - right click menu Delete?


Sorry, it was my mistake, I meant right click + delete record OR select the record and delete by the keyboard delete key.
 
Last edited:

AlefAelol

Registered User.
Local time
Today, 04:31
Joined
May 21, 2014
Messages
75
Why use VBA and not just the intrinsic prompt for "Do you really want to delete?"?
I just wanted to customize the delete confirmation message to be more readable. Because, the deleted record is marked as "cascade delete related records" so the intrinsic confirmation message would be confused to the user. BUT, even when I delete the VBA code, the intrinsic prompt firing twice.
 

AlefAelol

Registered User.
Local time
Today, 04:31
Joined
May 21, 2014
Messages
75
Um, Delete button? What button? Please post exactly how you delete a record.
Sorry, it was my mistake, I meant right click + delete record OR select the record and delete by the keyboard delete key.
 

JHB

Have been here a while
Local time
Today, 03:31
Joined
Jun 17, 2012
Messages
7,732
Hello everybody, what cause of delete confirmation message to appear twice? I'm trying to delete a record from subform of nested forms, but I got Cascade deletion to appear two times when I cancel the deletion, however, it appears once if I confirm the deletion process. Any help please ?
I can't reproduce your problem, could you post your database with some sample data, (zip it) + description how you delete the record!
 

Users who are viewing this thread

Top Bottom