Total Visual SourceBook

Total Visual SourceBook CD and Printed Manual

Microsoft Access/ Office 2016, 2013, 2010, and 2007 Version
is Shipping!

New features in Total Visual SourceBook for Access, Office 2007 and VB6

Supports Access/Office 2016, 2013, 2010 and 2007, and Visual Basic 6.0!

Separate version for Access/Office 2003, 2002, and 2000.

Separate version for:
Access 97/95


View all FMS products for Microsoft AccessAll Our Microsoft Access Products

SourceBook Info:

Why SourceBook?

 

"The code is exactly how I would like to write code and the algorithms used are very efficient and well-documented."

Van T. Dinh, Microsoft MVP

 

 

 

Microsoft Access, Office/VBA, VB6 Modules royalty-free source code libraryMicrosoft Access Modules royalty-free source code libraryMicrosoft Access VBA and VB6 Module Library Free trial of Total Visual SourceBook for Microsoft Access, Office, VB6 and VBA

Module: References in Category General VBA/VB6 : References from Total Visual SourceBook

Manage library references from VBA projects

Procedure List

Procedure Name

Type

Description

(Declarations) Declarations Declarations and private variables for the modReferences module
ReferenceAddFromFile Procedure Adds a reference from the specified file. In order to reference objects of code from another database or library in your VBA code, you need to add a Reference to that database or object. This can be done manually using the Tools|References option from the VBA project menu. To work with references programmatically, you use the References collection of the Application object. This procedure uses the AddFromFile method of the References collection to add a new reference.
ReferenceExists Procedure Determine if the named reference exists in the current project. In order to reference objects of code from another database or library in your VBA code, you need to add a Reference to that database or object. This can be done manually using the Tools|References option from the VBA project menu. To work with references programmatically, you use the References collection of the Application object. This procedure uses this collection to determine if a reference exists. Note: The reference may exist and still be invalid. See the ReferenceIsValid() procedure.
ReferenceIsValid Procedure Determine if the named reference is valid (non-broken). In order to reference objects of code from another database or library in your VBA code, you need to add a Reference to that database or object. This can be done manually using the Tools|References option from the VBA project menu. To work with references programmatically, you use the References collection of the Application object. This procedure uses this collection to determine if a reference is valid.
ReferenceNamesToArray Procedure Fills the passed array with a list of reference names. In order to reference objects of code from another database or library in your VBA code, you need to add a Reference to that database or object. This can be done manually using the Tools|References option from the VBA project menu. To work with references programmatically, you use the References collection of the Application object. This procedure uses this collection to populate the passed array with a list of all current references in the current database.
ReferenceNamesToString Procedure Fills the passed string with a list of reference names. In order to reference objects of code from another database or library in your VBA code, you need to add a Reference to that database or object. This can be done manually using the Tools|References option from the VBA project menu. To work with references programmatically, you use the References collection of the Application object. This procedure uses this collection to populate the passed string with a list of all current references in the current database.
ReferencesToArray Procedure Populate an array with a list of references in the current project. This function is similar to ReferencesToArray() except that it includes additional type information for each reference.

Example Code for Using Module: References

' Example of modReferences
'
' To use this example, create a new module and paste this code into it.
' Then run the procedure by putting the cursor in the procedure and pressing:
'    F5 to run it, or
'    F8 to step through it line-by-line (see the Debug menu for more options)

Private Sub Example_modReferences()
  ' Comments: Examples of using the modReferences module in VBA.

  Const cstrLibrary As String = "ADODB"
  Dim astrRefs() As String
  Dim strRefs As String
  Dim intCounter As Integer
  Dim intCount As Integer

  ' See if a specific reference exists.
  If ReferenceExists(cstrLibrary) Then
    ' Check to see if the reference is broken
    If ReferenceIsValid(cstrLibrary) Then
      MsgBox cstrLibrary & " is a valid reference."
    Else
      MsgBox "The library reference to " & cstrLibrary & " is broken."
    End If
  Else
    MsgBox cstrLibrary & " is not referenced."
  End If

  ' Get reference names to an array
  intCount = ReferenceNamesToArray(astrRefs())
  For intCounter = LBound(astrRefs) To UBound(astrRefs)
    Debug.Print astrRefs(intCounter)
  Next intCounter
  Debug.Print

  ' Get reference names to a string
  ReferenceNamesToString strRefs, ","
  Debug.Print strRefs
  Debug.Print

  ' Get reference names and paths to an array
  Erase astrRefs
  intCount = ReferencesToArray(astrRefs(), True)

  ' Display the list of references in the Immediate Window
  For intCounter = LBound(astrRefs) To UBound(astrRefs)
    Debug.Print astrRefs(intCounter)
  Next intCounter

  ' This is how to add a reference to the MyDLL dynamic link library programmatically.
  ' Note that this may not work when running in a compiled state.
  ' It is commented out here to avoid changing your project.
  'Debug.Print ReferenceAddFromFile("c:\windows\system\MyDLL.dll")

End Sub

Microsoft Access Module LibraryOverview of Total Visual SourceBook

The source code in Total Visual SourceBook includes modules and classes for Microsoft Access, Visual Basic 6 (VB6), and Visual Basic for Applications (VBA) developers. Easily add this professionally written, tested, and documented royalty-free code into your applications to simplify your application development efforts.

Additional Resources