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

remove MSCAL.OCX reference in external database

Status
Not open for further replies.

chanman525

IS-IT--Management
Oct 7, 2003
169
0
0
US
Hello All,

Need some extra brains on this issue. Been cruising the forum and searching for scenarios but can't seem to find any that would match what i need to do.

I'm running Office 2010 all machines in all locations and as some of you may know Microsoft removed the ActiveX calendar control in lue of date picker option.

A small piece of code was created to remove the reference however you have to run it on a machine that has the missing reference in order for it to be removed after opening the database. Of course, once removed then it is good for any user since it is stored on a network share.

I would like to be able to remotely remove the reference from code of another database.

Basically execute an "update database" that has the code snippet in it that will verify existence of the MSCAL.OCX and remove if necessary or ignore because the reference is not there.

The reason for this type of request is that there are 16 different physical locations (16 diff database) that the update will need to occur.

Thanks for the time and ideas.
 
Currently installing different version of Access and it has been years since I read about references so no digging here...

But if you have the references code... you should be able to create a new access application through automation, use the opencurrentdabase method of the applciation object to open an existing file, and then do whatever you need to to that file's objects through automation.
 
SO something like this:

Code:
[blue]Option Explicit

Sub Example()
    MsgBox "Removed: " & RemoveRef("msacal", "f:\Database3.accdb")
End Sub

Public Function RemoveRef(strName As String, strDatabase As String) As Boolean
    Dim MyRef As Object
    
    With CreateObject("Access.Application")
        .OpenCurrentDatabase strDatabase
        For Each MyRef In .VBE.ActiveVBProject.References
            If UCase(MyRef.Name) = UCase(strName) Then
                .VBE.ActiveVBProject.References.Remove MyRef
                RemoveRef = True
            End If
        Next
    End With
    
End Function[/blue]
 
thank you for the feedback strongm. We ran it and it works great on databases that have the activex in place but on the ones that have it as a missing reference (MSCAL.OCX is not present in office folder) we receive an error, "can't find project or library". Is there way to test for the existence and if missing then just force the removal like you would in the GUI of unchecking the box for the missing reference?

Thanks for the time and help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top