Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Avoiding Multiple Deletions 1

Status
Not open for further replies.

MSMINNICH

Programmer
Oct 3, 2001
33
0
0
US
Hi, All.
I have a question that I'm hoping one of you gurus has solved in the past. I have a bound form with Record Selectors and I'm trying to make it as user friendly as possible. In the BeforeDeleteConfirm event I'm asking the user to confirm that they want to delete the record (I'm doing it in code so I can ask the user to confirm by name the data that they are deleting). This works OK, but I am not sure what to do if the user selects multiple records and then hits the delete key. The BeforeDeleteConfirm event only fires once... Any suggestions? It would be OK if the user had to select each record for deletion seperately.
Thanks;
Scott
 
Here is a very simple way to do it. Instead of the BeforeDeleteConfirm event I use the Delete event. Change the blue to be a controlname from your form....


Private Sub Form_Delete(Cancel As Integer)

If MsgBox("Do You Really Want To Delete " & Me.FieldName, vbOKCancel) = vbCancel Then Cancel = True

End Sub

Note- You can have as many fields from the form as you want appear, this way the user know which record is being referenced.
 
That is one of those simple, elegant solutions that only comes around occasionally. Thanks!
Scott
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top