Rocky Smolin - Beach Access Software
bchacc at san.rr.com
Tue Aug 8 14:45:03 CDT 2006
Marty: Access.References.Remove refCurr still generates error: -2147319779 - Object library not registered. Rocky MartyConnelly wrote: > Grr, I am always mixing up Reference and References collection > Could try disambiguating the code like this > > Dim refCurr As Access.Reference > Dim intCount As Integer > > > For intCount = Access.References.Count To 1 Step -1 > Set refCurr = Access.References(intCount) > If Not refCurr.BuiltIn Then > If refCurr.IsBroken Then > 'might want to check if it has a valid name otherwise skip > 'or use on error next > ' debug.print refCurr.name > > Access.References.Remove refCurr > End If > End If > Next > > > > Rocky Smolin - Beach Access Software wrote: > > >> P.S. This reference, when it's there, references a .exe. Don't know if >> that makes any difference. >> >> 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