[AccessD] Test for a Particular Reference in Code.

Mitsules, Mark S. (Newport News) Mark.Mitsules at ngc.com
Wed Aug 4 12:57:42 CDT 2004


Greg,

This is from my personal archives...

******************
> If IsBroken is buggy how else can I check the references?

For A97, this function can be used:

Public Function IsBroken97(ByVal ref As Access.Reference) As Boolean

' Alternative method to check if a reference is broken
' as the IsBroken property cannot be used in Access97.
'
' 2000-03-19. Gustav Brock. Cactus Data ApS.

' Refer to this article at Microsoft Technet:
'
' Article ID: Q186720
'
' The information in this article applies to:
' Microsoft Access 97
'
' SYMPTOMS
' In Microsoft Access, IsBroken is a property of the References collection.
' The Microsoft Access Help topic on the Isbroken property states the
following:
'
' The IsBroken property returns a Boolean value indicating whether a
' Reference object points to a valid reference in the Windows Registry.
'
' Although this statement is correct, to receive this Boolean value
' you must trap for errors that are generated by the broken reference.
' Also, the IsBroken property becomes True only when the file being
referenced
' is deleted and the Microsoft Windows Recycle Bin is emptied.
' This article details the steps necessary to receive the Boolean value.

  Dim booRefOK As Boolean
  On Error GoTo Err_IsBroken97

  If Len(Dir(ref.FullPath, vbNormal)) > 0 Then
    booRefOK = Not ref.IsBroken
  End If

Exit_IsBroken97:
  IsBroken97 = Not booRefOK
  Exit Function

Err_IsBroken97:
  ' Ignore non existing servers, drives, and paths.
  Resume Exit_IsBroken97

End Function
******************

-----Original Message-----
From: Greg Smith [mailto:GregSmith at starband.net] 
Sent: Wednesday, August 04, 2004 1:39 PM
To: accessd at databaseadvisors.com
Subject: [AccessD] Test for a Particular Reference in Code.


Hi everybody!

I'm trying to distribute an app that I've modified and I'm running into
references issues at the client's site.  It's in Access97 (but not for
much longer).  I'm having to reference Microsoft Office 8.0 Object Library
(mso97.dll) and I have it update the reference through the code.  However,
if it already is referenced, then I get the error that you can't have a
reference with the same name, etc.

What I need to do is test to see if this reference already exists.  If it
does, then don't add it.  But I can't figure out how to test for it
specifically.  Is there a way to test for a particular reference (in this
case, the one for the MSOffice 8.0 Obj lib?

TIA!

Greg Smith
gregsmith at starband.net


-- 
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list