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

Problem in setup dll and ocx files

Status
Not open for further replies.

nkavitha

Programmer
Jun 8, 2001
5
US
Hi,

I am new to Access Programming. In my application, I have used some Active X controls, such as Common Dialog controls, etc. My system contains all the required DLL and OCX files.

But if I copy the same mdb application files, to another system which doesn't have VB or any of the OCX files, then its giving "Project or Library not Found" Error.

If I go to Tools -> References option and if I deselect the missiong libraries, then its working. But the ActiveX controls are not working.

I want to send this application to Client place. So how can make a setup, to copy all the required DLL and OCX files. ? VB having method to setup these files, while creating package and deployment. But I don't have any idea about MS Access.

Can anybody have an answer for this question, pls help me out. ?

Thanks in Advance.

Regards
Kavitha
 
hi there,
Dont know whether u still need help or not. The package and deployment for Access is in the Add-In Manager in VBA coding.
 
Hi, Kavitha!

This situation is known for me. I think ActiveX libraries which are missing have other location.

Deselect the missing libraries and create references to these libraries again by using Browse command button. Find its location before this operation: it will be simplified creating of references. Don't forget about reverences' positions.

I solved this problem by creating table for references parameters saving:
Table name: MyReferences

Field Name Type Size
RefPosition Long 1
RefName Text 20
RefVersion Text 15
RefFileName Text 20
RefPath Text 250

In the table I save references parameters and after I copy DB to another computer I'm running codes for references refreshing.

Call CurrentReferencesSave

Sub CurrentReferencesSave()
'This procedure saves reference parameters in the table
Dim ref As Reference
Dim rst As Recordset
Dim i As Byte

'Delete references parameters in the table
DoCmd.SetWarnings False
DoCmd.RunSQL "DELETE MyReferences.* FROM MyReferences;"
DoCmd.SetWarnings True

'Next commands require reference to DAO library
Set rst = CurrentDb.OpenRecordset("SELECT RefName, RefFileName, RefVersion, RefPath, RefPosition FROM MyReferences;")
' Enumerate through References collection.
For Each ref In References
' Add reference parameters into table
If ref.IsBroken = False Then
With rst
i = i + 1
.AddNew
!RefName = ref.Name
!RefFileName = UCase(Dir(ref.FullPath))
!RefVersion = ref.Major & "." & ref.Minor
!RefPath = ref.FullPath
!RefPosition = i
.Update
End With
End If

Next ref
rst.Close
Set rst = Nothing
End Sub


'After DB copying copy and run following codes:

Call RemoveReferences 'remove current references for refreshing its
Call CreateMyReferences 'Create new references
Call CurrentReferencesSave 'Save library paths, reference names, library file names in the table


Copy following codes and procedure CurrentReferencesSave (above) into module on your DB.

'---------------------------------
Public HddDrives()
Public CountOfHDD As Byte

'---------------------------------
Sub RemoveReferences()
'Remove all allowed for removing references
Dim ref As Reference

On Error Resume Next
'Enumerate and remove references
For Each ref In References
References.Remove ref
Next ref
End Sub

'--------------------------------
Sub AvailableHDD()
'Put Available HDD drive letters into array
Dim fs, D, dc
Dim strList As String
Dim i As Byte

Set fs = CreateObject("Scripting.FileSystemObject")
'Get drives
Set dc = fs.Drives
For Each D In dc
If D.DriveType = 2 Then 'HDDs
i = i + 1
If i = 1 Then
ReDim HddDrives(1)
Else
ReDim Preserve HddDrives(i)
End If
HddDrives(i) = D.DriveLetter
End If
Next D
CountOfHDD = i 'Count of Available HDDs
End Sub
'------------------------------------
Sub CreateMyReferences()
On Error GoTo Err_CreateMyReferences
Dim ref As Reference
Dim i As Byte
Dim k As Byte
Dim k0 As Byte
Dim strMsg As String
Dim strRefFileName As String
Dim strRefPath As String
Dim strRefName As String

'Check for Available HDD drives
Call AvailableHDD
'Create new references by references table
k0 = DCount("RefName", "MyReferences")
For k = 3 To k0 'First and second refs are read only
strRefPath = DLookup("RefPath", "MyReferences", "RefPosition=" & k)
strRefFileName = DLookup("RefFileName", "MyReferences", "RefPosition=" & k)
strRefName = DLookup("RefName", "MyReferences", "RefPosition=" & k)
If Dir(strRefPath) = "" Then 'Other library location that table defined
For i = 1 To CountOfHDD 'Check for library file on all avialable drives
strRefPath = OneFileLocation(strRefFileName, CStr(HddDrives(i))) 'User-defined function
If strRefPath <> &quot;&quot; Then
Exit For
End If
Next i
End If
If strRefPath <> &quot;&quot; Then
'Create reference
Set ref = References.AddFromFile(strRefPath)
Else
'Missing references message compose
strMsg = vbTab & strMsg & vbLf & strRefName & &quot; (&quot; & strRefFileName & &quot;)&quot;
End If
NextRef:
Next k
If strMsg <> &quot;&quot; Then
MsgBox &quot;There was not created references to following libraries:&quot; & _
strMsg & vbLf & &quot;Some controls of application may be not worked&quot;, _
vbInformation, &quot;References&quot;
End If

Exit_CreateMyReferences:
Exit Sub

Err_CreateMyReferences:
If Err.Number = 32813 Then 'Name conflicts with existing module, project, or object library
Resume Next 'GoTo NextRef
End If
MsgBox &quot;Error No &quot; & Err.Number & vbLf & Err.Description, , &quot;Sub CreateMyReferences&quot;
Resume Exit_CreateMyReferences
End Sub
'------------------------------
Function OneFileLocation(strFileName As String, Optional strDrive As String = &quot;C&quot;) As String
'Search file on defined drive (not shared)
'Return first found file path
'If is omited strDrive then file is searching on drive &quot;C&quot;

Dim strFileList As String

strDrive = Left(strDrive, 1)
strDrive = strDrive & &quot;:\&quot;
With Application.FileSearch
.LookIn = strDrive
.SearchSubFolders = True
.FileName = strFileName
If .Execute() > 0 Then
OneFileLocation = .FoundFiles(1)'First found file
End If
End With

End Function


Good luck!
Aivars
alaganovskis@hotmail.com
 
I have the same problem now. Have you been abel to solve your problem? Can you tell me how?

Greetings D
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top