Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to drop a Tools/Reference item with VBA? 1

Status
Not open for further replies.

steve728

Programmer
Mar 16, 2003
536
US
Will someone please provide me a sample of how to use VBA to add / remove a reference in MS Access 2003.

Thanks in advance,

Steve728
 
Some notes, you will find more in Help.

Code:
Sub Rem_Ref()
    References.Remove References("DAO")
End Sub

Sub AddDAO()
    ReferenceFromFile "C:\Program Files\Common Files\Microsoft Shared\DAO\dao360.dll"
End Sub

Function ReferenceFromFile(strFileName As String) As Boolean
    Dim ref As Reference

    On Error GoTo Error_ReferenceFromFile
    Set ref = References.AddFromFile(strFileName)
    ReferenceFromFile = True

Exit_ReferenceFromFile:
    Exit Function

Error_ReferenceFromFile:
    MsgBox Err & ": " & Err.Description
    ReferenceFromFile = False
    Resume Exit_ReferenceFromFile
End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top