3.jpg
 
 
  08/10/10 - Create DELETE Audit Tables in SQL Server
 
  08/10/10 - Stuck on how to connect to a data source?
 
  08/10/10 - SQL Server: Easily Grant Select to All Tables and/or Views in a Database
 
  08/10/10 - Using SQL Server Views with Access: Index needed for editing data.
 
  08/10/10 - Using a SQL Server stored procedure with a insert query in Access
 
  08/10/10 - How to create PDFs in Word using Access VBA
 
  08/10/10 - Part 2 Access ADP Tip : Get rid of the login box on startup
 
  08/10/10 - Part 1 Access ADP Tip: Using ADP ServerFilter property
 
  08/10/10 - Launch Email Window from Form
 
  08/10/10 - Part 3: Why I grew to love Microsoft Access Data Projects
 
  08/10/10 - Map route on Google Maps with Addresses in Access
 
  08/10/10 - Map route on Yahoo Maps with Addresses in Access
 
  08/10/10 - Tips for designing SQL Server tables for Microsoft Access
 
  08/10/10 - Inserting a record in SQL Server and retrieving key ID.
 
  08/03/10 - Spell out date, i.e.,
 
 
 
Access Help: BeforeDelConfirm Event Displays no Data
by Juan Soto - 08/03/10
 
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.

 
Copyright © 2006 ITimpact.com