Using Record Selectors

G

Guest

Hi all,

I have a continuous form with record selectors enabled. I figured out how
to use docmd.runcommand acCmdDeleteRecord to delete the record that is
selected using the record selectors. My question is how can I use the record
selectors to display a pop-up that says "are you sure you want to delete
record X with values 1, 2, 3?" So they can verify they selected the correct
record?

Thanks in advance, always a great place to get good answers!
 
J

John Vinson

Hi all,

I have a continuous form with record selectors enabled. I figured out how
to use docmd.runcommand acCmdDeleteRecord to delete the record that is
selected using the record selectors. My question is how can I use the record
selectors to display a pop-up that says "are you sure you want to delete
record X with values 1, 2, 3?" So they can verify they selected the correct
record?

Thanks in advance, always a great place to get good answers!

You can use the BeforeDeleteConfirm event to pop a message. Set Cancel
to TRUE if they don't want it deleted.

John W. Vinson[MVP]
 
G

Guest

Well if I select the record, with the record selector, say record 1. Hit the
delete key, it removes the record from view, my beforedeleteconfirm codes
runs which is just :

Private Sub Form_BeforeDelConfirm(Cancel As Integer, Response As Integer)

If MsgBox("Are you sure you want to delete?" & vbCrLf & "SiteID: " &
Me.SiteID & _
vbCrLf & "Name: " & Forms!frmSites!Name & vbCrLf & "Location: " &
Me.Location, vbYesNoCancel, "Del Confirm") = vbYes Then
MsgBox "Yes"
Else
MsgBox "no"
End If

End Sub

And it displays the wrong record. It is like it removes it from view and
sets the record selector to the next record.. runs the code, which asks about
the wrong record, then I click no in Access' premade warning and the record
comes back. How can I get it to display a warning for the record info you
are about to delete?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top