[AccessD] Removing a missing reference

A.D.TEJPAL adtp at hotmail.com
Tue Aug 15 14:41:46 CDT 2006


Rocky,

    Revised sample code in command button's click event is given below.

A.D.Tejpal
---------------

=======================================
Private Sub CmdTest_Click()
    Dim ref As Reference
    
    For Each ref In Application.References
        If ref.IsBroken = True Then
            MsgBox "Missing Reference: " & ref.Name & _
                        vbCrLf & "Path: " & ref.FullPath & _
                        vbCrLf & "(This Reference has now been removed)"
            Application.References.Remove ref
        End If
    Next
End Sub
=======================================


----- Original Message ----- 
From: A.D.TEJPAL 
To: Access Developers discussion and problem solving 
Cc: ADT 
Sent: Wednesday, August 16, 2006 00:42
Subject: Re: [AccessD] Removing a missing reference


Rocky,

    If it is a question of merely clearing the check box for each missing reference, skeleton subroutine as given below, is found to do the job.

    Command button named CmdTest is located on a plain form with no other code in its module that is in any way dependant upon any of the likely missing references (This ensures that there is no problem in running the particular subroutine in question).

Best wishes,
A.D.Tejpal
---------------

Code in test form's module
=======================================
Private Sub CmdTest_Click()
    Dim ref As Reference
    
    For Each ref In Application.References
        If ref.IsBroken = True Then
            MsgBox "Missing Reference: " & ref.Name & _
                        vbCrLf & "Path: " & ref.FullPath & _
                        vbCrLf & "(This Reference has now been removed)"
            References.Remove ref

            ' Statement (A) below gives compile Error
            ' However, the purpose is served 
            ' even if it is kept disabled
            ' RemoveReference = True     (A)
        End If
    Next
End Sub
=======================================

  ----- Original Message ----- 
  From: Charlotte Foust 
  To: Access Developers discussion and problem solving 
  Sent: Monday, August 14, 2006 20:59
  Subject: Re: [AccessD] Removing a missing reference


  Are you saying that it finds a reference and can tell it's broken but
  throws an error when you try to remove it? Have you checked to be sure refCurr is not nothing?

  Charlotte Foust 

  -----Original Message-----
  From: accessd-bounces at databaseadvisors.com
  [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin
  - Beach Access Software
  Sent: Tuesday, August 08, 2006 12:45 PM
  To: Access Developers discussion and problem solving
  Subject: Re: [AccessD] Removing a missing reference

  Marty:

  Access.References.Remove refCurr still generates error: -2147319779 -
  Object library not registered.  

  Rocky


More information about the AccessD mailing list