[AccessD] Removing a missing reference

Rocky Smolin - Beach Access Software bchacc at san.rr.com
Tue Aug 8 13:29:35 CDT 2006


Gustav:

The code I was using did go backwards through the references but still 
choked on the first one which was the missing reference.  Seems there's 
nothing in the reference so MsgBox ref.Name fails as well as .Remove.

Rocky


Gustav Brock wrote:
> Hi Rocky
>
> Further to Charlotte's comments, I faintly recall you have to move backwards in the References collection:
>
> Public Function ReferencesClean() As Boolean
>
> ' Remove all missing references.
> ' Return True if no reference was removed.
> '
> ' 2001-08-20. Cactus Data ApS, CPH.
>
>   Dim ref         As Reference
>   Dim lngItem     As Long
>   Dim booMissing  As Boolean
>   
>   With References
>     For lngItem = .Count To 1 Step -1
>       Set ref = .Item(lngItem)
>       If ref.BuiltIn = True Then
>         ' No need to check built in reference.
>       ElseIf IsBroken97(ref) Then
>         .Remove ref
>         booMissing = True
>       End If
>     Next
>   End With
>   
>   Set ref = Nothing
>   
>   ReferencesClean = Not booMissing
>   
> End Function
>
> Still, your code will be left non-compiled after this. A method to compile the code is described by Charlotte and me if you search the archives of July 2003 for:
> "Broken References in Runtime AXP and A97"
>
> /gustav
>
>   
>>>> bchacc at san.rr.com 08-08-2006 19:46:07 >>>
>>>>         
> Dear List:
>
> Still struggling with this references thing.  It seem the easiest thing 
> to do would be to remove the missing reference in the Open event of the 
> opening form in the event the app is loaded onto a machine which doesn't 
> have the library.  However, all the code that I've seen to remove 
> missing references fail.  Code like:
>
> Dim refCurr As Reference
>     For Each refCurr In References
>         If refCurr.IsBroken Then
>             References.Remove refCurr
>         End If
>     Next
>
> Seems straightforward but when it comes to the missing reference it 
> errors out on the .Remove line because it doesn't have a name.  So.  How 
> do you remove a missing reference when the application the reference is 
> referring to doesn't exist?
>
> MTIA
>
> Rocky
>
>   

-- 
Rocky Smolin
Beach Access Software
858-259-4334
www.e-z-mrp.com




More information about the AccessD mailing list