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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Programatically Activate/Deactivate References

Status
Not open for further replies.
Aug 24, 2004
98
US
Is there any way to programmaticaly activate or deactivate Access references such as DAO 3.6, VBscript etc or Do I have to every time go into the tools menu and activate and deactivate there?

Thank you
 
A starting point:
Sub ReferenceInfo()
Dim strMessage As String
Dim strTitle As String
Dim refItem As Reference
On Error Resume Next
For Each refItem In References
If refItem.IsBroken Then
strMessage = "Missing Reference:" & vbCrLf & refItem.FullPath
Else
strMessage = "Reference: " & refItem.Name & vbCrLf _
& "Location: " & refItem.FullPath
End If
Debug.Print strMessage
Next refItem
End Sub

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
To expand on what PHV said, this is from the ACCESS help file:

The first of the following two functions adds a reference to the calendar control to the References collection. The second function removes the reference to the calendar control.

Function AddReference() As Boolean
Dim ref As Reference, strFile As String

On Error GoTo Error_AddReference
strFile = "C:\Windows\System\Mscal.ocx"
' Create reference to calendar control.
Set ref = References.AddFromFile(strFile)
AddReference = True

Exit_AddReference:
Exit Function

Error_AddReference:
MsgBox Err & ": " & Err.Description
AddReference = False
Resume Exit_AddReference
End Function

Function RemoveReference() As Boolean

Dim ref As Reference

On Error GoTo Error_RemoveReference
Set ref = References!MSACAL
' Remove calendar control reference.
References.Remove ref
RemoveReference = True

Exit_RemoveReference:
Exit Function

Error_RemoveReference:
MsgBox Err & ": " & Err.Description
RemoveReference = False
Resume Exit_RemoveReference
End Function

HTH
PaulF
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top