Hi all,
My apologies first for making another thread on this issue. I have tried all solutions I have managed to locate with no success.
I am developing in Access 11. A small percentage of my users are using Access 9. When the Access 9 users attempts to open the database, the 'Outlook' reference is broken.
I am attempting to automate the process of removing the broken reference and adding the correct based on the version number.
I have found three methods -
1. Microsoft method
Note: Using this method the broken reference has strPath NULL. Not sure whether this is relevant.
2. Using code found on this forum
Note: This method generates an error message (I cannot replicate right at this moment but it is something like 'Object not found in library'
3. Unload references at close and load at startup
The remove reference function fails for me - have tried both of the above lines of code.
Can anyone suggest another solution or point out where perhaps I may be going wrong with this?
Thanks,
Rob
My apologies first for making another thread on this issue. I have tried all solutions I have managed to locate with no success.
I am developing in Access 11. A small percentage of my users are using Access 9. When the Access 9 users attempts to open the database, the 'Outlook' reference is broken.
I am attempting to automate the process of removing the broken reference and adding the correct based on the version number.
I have found three methods -
1. Microsoft method
Code:
Dim loRef As Access.Reference
Dim intCount As Integer
Dim intX As Integer
Dim blnBroke As Boolean
Dim strPath As String
On Error Resume Next
'Count the number of references in the database
intCount = Access.References.Count
'Loop through each reference in the database
'and determine if the reference is broken.
'If it is broken, remove the Reference and add it back.
For intX = intCount To 1 Step -1
Set loRef = Access.References(intX)
With loRef
blnBroke = .IsBroken
If blnBroke = True Or Err <> 0 Then
strPath = .FullPath
With Access.References
.Remove loRef
.AddFromFile strPath
End With
End If
End With
Next
Set loRef = Nothing
' Call a hidden SysCmd to automatically compile/save all modules.
Call SysCmd(504, 16483)
Note: Using this method the broken reference has strPath NULL. Not sure whether this is relevant.
2. Using code found on this forum
Code:
Dim intCount As Integer
For intCount = Access.References.Count To 1 Step -1
Set ref = Access.References(intCount)
If ref.IsBroken Then
Access.References.Remove ref
End If
Note: This method generates an error message (I cannot replicate right at this moment but it is something like 'Object not found in library'
3. Unload references at close and load at startup
Code:
References.Remove (Outlook)
References.Remove ("C:\Program Files\Microsoft Office\OFFICE11\msoutl.olb")
The remove reference function fails for me - have tried both of the above lines of code.
Can anyone suggest another solution or point out where perhaps I may be going wrong with this?
Thanks,
Rob