[AccessD] Missing records

Jürgen Welz jwelz at hotmail.com
Fri Feb 3 16:05:13 CST 2006


One trick is not to forget to remove deletion capability.  I have a series 
of routines that are run when an update is released to users.  The update 
'cannot' be distributed without running the update procedure that moves the 
update to the users' folders.  One of the sub routines called prior to the 
file copy sub routine is:

Public Sub RemoveDeletionCapabilitiesFromAllForms()
    On Error GoTo ErrorHandler

    Dim dbs As DAO.Database
    Dim ctr As Container
    Dim doc As Document

    Set dbs = CurrentDb
    Set ctr = dbs.Containers!Forms
    For Each doc In ctr.Documents
        DoCmd.OpenForm doc.Name, acDesign
        Forms(doc.Name).AllowDeletions = False
        DoCmd.Close acForm, doc.Name, acSaveYes
        DoEvents
    Next doc

ExitRoutine:
    On Error Resume Next
    Set doc = Nothing
    Set ctr = Nothing
    Set dbs = Nothing
    Exit Sub
ErrorHandler:
    With Err
        Select Case .Number
            Case Else
                MsgBox .Number & vbCrLf & .Description, vbInformation, 
"Error - RemoveDeletionCapabilitiesFromAllForms"
        End Select
    End With
    'Resume 0
    Resume ExitRoutine
End Sub

I could copy files manually and skip using the FE distribution procedure, 
but I have not done this once in the past 5 years because it is simpler and 
faster to run the code that handles updating the users.

I don't allow deletes.  PERIOD.  Cascades on or off.  Makes no difference.  
If I want to cascade "marked deleted', I have to do it in code.


Ciao
Jürgen Welz
Edmonton, Alberta
jwelz at hotmail.com





>From: "John Colby" <jwcolby at colbyconsulting.com>
>
> >I really prefer to control it at the form by not allowing deletes there.
>If they can't delete it at the form level then Cascade Deletes never 
>becomes
>an issue.
>
>And so I design a new form and forget to.... I am a VP and remoting in from
>home and build a query and...  I am the power user and manage to get to the
>database window and...
>
>Your job is to outsmart the idiots.  God's job is to design better idiots.
>Who has been on the job longer?
>
>The database engine has these things for a reason.  You can't delete my
>client record I don't care WHAT you do, without deleting all child records
>first, in all child tables.
>
>Again, I don't care if you use them, I just care that you UNDERSTAND the
>consequences of using them.  Lord knows if you don't have time to build a
>delete query and a button that only supervisors can get to, you don't have
>time to design an Active / trash system.
>
>Whatever you do, do NOT believe that backups can always rescue your young
>*ss.  If some particularly smart idiot has been unknowingly deleting things
>over the last year, you will NEVER get all the records out of all the 
>backup
>tapes.
>
>Understand the consequences, then make an informed decision.
>
>John W. Colby
>www.ColbyConsulting.com
>
>
>-----Original Message-----
>From: accessd-bounces at databaseadvisors.com
>[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Reuben Cummings
>Sent: Friday, February 03, 2006 12:15 PM
>To: Access Developers discussion and problem solving
>Subject: Re: [AccessD] Missing records
>
>Honestly, I'm not sold on Cascade Delete being off.  It makes it much 
>easier
>to work if it's on when record does require deletion (like your invoice
>example).
>
>I really prefer to control it at the form by not allowing deletes there.  
>If
>they can't delete it at the form level then Cascade Deletes never becomes 
>an
>issue.
>
>Reuben Cummings
>GFC, LLC
>812.523.1017





More information about the AccessD mailing list