-----Original Message-----
1. Open your form in design view.
2. Open the Properties box (View menu).
3. Making sure the title of the properties box says "Form" (so you are
looking at the properites of the form, not those of a text box), you will
find the On Delete and BeforeDelConfirm on the Events tab of the properties
box.
4. At the top of the form's module, add:
Dim strKeyList As String
5. Set up the Delete event procedure so it looks like this (replacing
PatientID with the name of your key field:
Private Sub Form_Delete(Cancel As Integer)
strKeyList = strKeyList & Me.[PatientID] & ", "
End Sub
6. Set up the BeforeDelConfirm event procedure so it looks like this:
Private Sub Form_BeforeDelConfirm(Cancel As Integer, Response As Integer)
Dim strMsg As String
strMsg = "Delete Key #" & vbCrLf & Left(strKeyList, Len(strKeyList) - 2)
strKeyList = ""
If MsgBox(strMsg, vbOKCancel, "Confirm Deletion") <> vbOK Then
Cancel = True
End If
Response = acDataErrContinue
End Sub
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Reply to group, rather than allenbrowne at mvps dot org.
Thanks for the reply. But I guess I also need to know how
or where to access the Delete and BeforeDelConfirm events
in my code. I'm using a control button to initiate the
delete record event. Please excuse my ignorance.
Thanks again,
Wendy
-----Original Message-----
That would involve an interplay of events.
In a datasheet, for example, you can select several
records, and then press
delete to delete several at once. The Delete event occurs
for each record
being deleted, and the record number is available at that
time. Then the
BeforeDelConfirm event occurs once for all the records
being deleted. This
is where the message pops up. You can easily replace the
message with your
own in this event, but the details of the records are not
available at this
time.
So, to achieve what you want, you would need to:
1. Declare a string variable in the General Declarations
section (top) of
the form's module.
2. Concatenate the record numbers into the string in the
Delete event.
3. Use that string to display the message in the
BeforeDelConfirm event, and
clear the string.
message
Hi, How can I intercept and modify the "You are about to
delete 1 record(s)" popup message to read "you are about
to delete record number ### , patient_name " ?
Thanks!