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

missing reference 1

Status
Not open for further replies.

Zygor

Technical User
Apr 18, 2001
271
US
Everytime I create a new database,Microsoft Office Web Compomets is automatically added as a refernce. Is there na way I can keep that from being added.

I know to remove it, manually and via code, but is there a registry edit I can do or something mlike that to just leave it out to begin with?
 
Because not every PC my program runs on has it and it's making them error.

Let me explain further.

I have a database that creates databases and sends them to co-workers. My database has thee reference removed, but when it makes a new one, via vba, the new one has the reference and it's sent to others where it errors when they launch it.
 
Yes

Here's how I did it

Function AddRefs()
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

intCount = Access.References.Count

For intX = intCount To 1 Step -1
Set loRef = Access.References(intX)
With loRef
If .FullPath = "C:\Windows\System32\stdole2.tlb" Or .FullPath = "C:\Program Files\Common Files\Microsoft Shared\Web Components\10\OWC10.DLL" Or .FullPath = "C:\Program Files\Common Files\SYSTEM\ADO\msado21.tlb" Then
Access.References.Remove loRef
End If
End With
Next

With Access.References
.AddFromFile "C:\Program Files\Common Files\Microsoft Shared\DAO\dao360.dll"
.AddFromFile "C:\Program Files\Common Files\Microsoft Shared\VBA\VBA6\vbe6.dll"
.AddFromFile "C:\Program Files\Microsoft Office\Office10\msacc.olb"
.AddFromFile "C:\Program Files\Microsoft Office\Office10\msword.olb"
.AddFromFile "C:\Program Files\Microsoft Office\Office10\EXCEL.EXE"
.AddFromFile "C:\Lotus\Notes\domobj.tlb"
.AddFromFile "C:\Lotus\Notes\notes32.tlb"
.AddFromFile "C:\Program Files\Common Files\System\ado\msado25.tlb"
End With

Call SysCmd(504, 16483)
End Function
 
What happens when the references you add don't exist? My experience is that not all of them exist on a computer.

Ascent
 

Propably you should use FileSystemObject or Dir to check the existance of a specified file to load and if not found... fire an Application.FileSearch, to lookin "C:\", search sub folders for that file name orderby last modified and grab the exact location of the file. If the file is not there BEEP! Of course searching might take some time!
 
Hi ZyGor

I have tryed numourus types of ref removers. They all work and.... they all have one flaw - they can not remove broken refrences....
Access will do this by itself IF your app is moving up from i.e. 9.0 to 10.0 but not vice versa say, if your app is moving from 10.0 to 9.0.
So if your app is moving down your app will not run, does anyone have a solution to this?

Herman
Say no to macros
 
Hi,

I believe the problem is that you cannot remove a reference to a not installed library. Ofcourse it is not installed if it regards a newer (office) version.

Maybe someone knows how to get by this problem?

EasyIT
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top