G
Guest
hi
I have a continuous subform set to AllowDeletions = true. I have a delete
button on each record in the subform. On the subform's before delete confirm
event, I have changed the default message and have set up a custom message
instead. In this message I am including the name fields from the record
which will be deleted as additional confirmation for the user. Even though
the correct record is deleted, this confirmation box is showing fields (First
Names and Surname) from the next record in the form! Why is this? And when I
click on the delete button for the very last record in the subform, it says
the names from the previous record in the form in the delete confirmation
message box. Very strange.
Here is the code I'm using for the subform's before delete confirm event:
Private Sub Form_BeforeDelConfirm(Cancel As Integer, Response As Integer)
' Suppress default Delete Confirm dialog box.
Response = acDataErrContinue
' Display custom dialog box.
If MsgBox("Are you sure you want to remove the driver " & [First Names]
& " " & Surname & " from this vehicle?" & vbNewLine & _
, vbOKCancel) = vbCancel Then
Cancel = True
End If
End Sub
I know that by default when you delete a record, the form shows the next
record in the table or query when the before delete confirmation message box
is displayed (even though the "current" record hasn't been deleted yet.)
Please see the post at
http://www.microsoft.com/office/com...8ada&catlist=&dglist=&ptlist=&exp=&sloc=en-us
(or find this post, "Delete Button Shows Previous Record Before the Current
Record is Deleted" in Access Forms in this forum.)
I imagine this is this something to do with it. Do you know a way around
this? Do I need to put the Application.Echo False into the Before Delete
Confirm code too?
Please help if you can.
TIA
Rich
I have a continuous subform set to AllowDeletions = true. I have a delete
button on each record in the subform. On the subform's before delete confirm
event, I have changed the default message and have set up a custom message
instead. In this message I am including the name fields from the record
which will be deleted as additional confirmation for the user. Even though
the correct record is deleted, this confirmation box is showing fields (First
Names and Surname) from the next record in the form! Why is this? And when I
click on the delete button for the very last record in the subform, it says
the names from the previous record in the form in the delete confirmation
message box. Very strange.
Here is the code I'm using for the subform's before delete confirm event:
Private Sub Form_BeforeDelConfirm(Cancel As Integer, Response As Integer)
' Suppress default Delete Confirm dialog box.
Response = acDataErrContinue
' Display custom dialog box.
If MsgBox("Are you sure you want to remove the driver " & [First Names]
& " " & Surname & " from this vehicle?" & vbNewLine & _
, vbOKCancel) = vbCancel Then
Cancel = True
End If
End Sub
I know that by default when you delete a record, the form shows the next
record in the table or query when the before delete confirmation message box
is displayed (even though the "current" record hasn't been deleted yet.)
Please see the post at
http://www.microsoft.com/office/com...8ada&catlist=&dglist=&ptlist=&exp=&sloc=en-us
(or find this post, "Delete Button Shows Previous Record Before the Current
Record is Deleted" in Access Forms in this forum.)
I imagine this is this something to do with it. Do you know a way around
this? Do I need to put the Application.Echo False into the Before Delete
Confirm code too?
Please help if you can.
TIA
Rich