microsoft access help database programing developer
Back to Access Experts About Access Experts Access Experts Websites Access Experts Team Access Experts Services Access Experts Case Studies Access Expert Tips Contact Access Experts OUR BLOG
 
 
Access Help: BeforeDelConfirm Event Displays no Data
by Juan Soto
06/03/2006

When using this event you will lose access to your data.

Access Programming Tip
Sometimes you may need to confirm deletion of a record with a user before allowing them to delete the record. The BeforeDelConfirm event will allow you to cancel the deletion if necessary. But one problem with this event is the lack of access to your data, therefore using form data is out of the question. To avoid the situation, use the Delete event on the form.

Delete Event Does Allow Access To Data
I had built a check register program for a client and one of the requirements was to prevent checks that were voided from being deleted. My program would look at the check number and if the word "Void" was in it, then prevent deletion of the database record. I used the Delete event and would set Cancel = True. Below is the code fragment I used:

        If Me.CheckNumber = "Void" Then
            Cancel = True
            Me.Undo
            MsgBox "Voided checks cannot be modified.", vbInformation, "Can't Change Check"
            Exit Sub
        End If


If you like this tip you will be delighted with our service! Call or write us today for a free quote regarding your computer needs.

Publish this article in your own corporate newsletter or publication! Contact us to obtain a free license.


Home | About Us Why PCExperts | Team | Services | Newsletter | Contact Us
Copyright © 2004