[AccessD] Devoloping with A2K3 for an A2K environment

MartyConnelly martyconnelly at shaw.ca
Tue Apr 4 18:36:26 CDT 2006


Use late binding with CreateObject and maybe use a conditional compile 
around Early and Late binding.

or you could use this code to  force a reference function on immediate 
entry to the mdb if you are sure of the path.
and a similar delete of old reference.

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
    dim 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




Function ReferenceFromFile(strFileName As String, _
              Optional Warning As Boolean) As Boolean
'ReferenceFromFile "c:\Windows\System\vbscript.dll\3" , True
' One caveat adding a reference this way forces a decompile
' so cannot be used in an MDE. At least not executed inside one to
' reset references.

    Dim ref As Access.Reference

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

Exit_ReferenceFromFile:
    Exit Function

Error_ReferenceFromFile:
    If Warning = True Then VBA.MsgBox Err & ": " & Err.Description
    ReferenceFromFile = False
    Resume Exit_ReferenceFromFile
End Function
Joe Rojas wrote:

>Hi All,
>
>I ran into a problem with installing Office 2003 Pro on my computer.
>I had created several databases with Access 2000, prior to my Office
>upgrade, which used the Outlook 9.0 (2000) object model. When I open
>these databases up, Access 2003 automatically changes the reference from
>Outlook 9.0 to 11.0.
>When a user, using Office 2000, opens this database they have a missing
>reference!
>
>How do others on this list deal with this issue where you are using a
>newer version of Office to develop than the user's environment?
>
>Thanks,
>Joe Rojas
>IT Manager
>TNCO, Inc.
>781-447-6661 x7506
>jrojas at tnco-inc.com
>
>  
>

-- 
Marty Connelly
Victoria, B.C.
Canada






More information about the AccessD mailing list