Question regarding object libraries

utzja1

Registered User.
Local time
Today, 17:14
Joined
Oct 18, 2012
Messages
97
Greetings, I have a database that I'm about to deliver to a client. There are many modules built into the forms to validate input, add functionality, etc. In order to get the modules to run, I had to attach several object libraries that aren't automatically loaded in the default database.

My question is whether the object libraries will remain loaded in the database when I copy it onto the client's network, or will I need to install it and then verify that the needed object libraries are attached?

Also, I know the client is running an earlier version of Windows (I'm running Windows 7 Enterprise, I suspect they are running Vista or XP). If I attach an object library that is v14.0 and their system doesn't have that, is Windows smart enough to substitute v12.0 (or v10.0), or does that need to be checked also?

Many thanks for your time!
 
This is old (2002) but it should put things into perspective.
http://allenbrowne.com/ser-38.html
The important part is that each Client PC must have access to the object library, and should have reference to the same version of the object.
So, if the Access 2010 has reference to Excel 2010 - but the XP client only has Excel 2000 there is the resolution of the Version of Excel to deal with. If Excel 2010 has a object language difference that was not yet invented in Excel 2000, that will also cause a problem. The latter problem might be handled with error trapping code.

Using Late Binding - find out which version of excel the user has installed and then set your references accordingly this should work with no references to Excel set. Late binding is not as efficient as the iUnknown COM interface is not referenced as a specific object type. It also means that intellisense won't work during programming.

Dim xl As Object ' Object is generic
Set xl = CreateObject("excel.application")
MsgBox xl.Version
Set xl = Nothing

Using Late Binding for all your coding - just don't set any references at all and do all your work with the xl variable. The same would apply for the other objects.


one more tip - using code at startup. Warn user about the references.
Code:
'---------------------------------------------------------------------------------------
' Procedure : Get_References_In_This_Project
' Purpose   : List all the references in the VBA Project and indicate where
'the reference is OK or Is Broken (Missing)
' Get the name, description, full path and "Missing/Brtoken" for each reference
'---------------------------------------------------------------------------------------
'
Sub Get_References_In_This_Project()
Dim refIsBroken As String
'Loop thru each reference in this VBA Project
For Each ref In Application.VBE.ActiveVBProject.References
    refIsBroken = "OK"
' Get the Reference Name 
refName = ref.Name
' Get the Reference Description
refDesc = ref.Description
refPath = ref.FullPath
'Return True/False  indicating if Reference link is broken: True(Ref is missing) or False (Ref OK)
    If ref.IsBroken = True Then
        refIsBroken = "***Missing/Broken***"
    Else
    refIsBroken = "OK"
    End If
Debug.Print refName & ":  " & refDesc & " - " & refPath & " -> " & refIsBroken
Next ref
End Sub

Yet one more note:
When using Late Binding, some of the code that worked in Excel VBA might not work in Late Binding. Excel Constants for example might need to be converted over to their numerical equivalent. These can typically be found in the F2 (Object Browser) in the code module. This is an example for Excel, other objects can have this same issue with late binding.
 

Users who are viewing this thread

Back
Top Bottom