hitechboy78737
Programmer
I have a reference to the JRO class (under the References Folder in the solution explorer) and import it in my class (using "Imports JRO".
When I use JRO.JetEngine.CompactDatabase I get an error from the JetEngine- "Class Not Registered".
Isn't it registered by creating a reference to it in the VS IDE?
This is my code:
When I use JRO.JetEngine.CompactDatabase I get an error from the JetEngine- "Class Not Registered".
Isn't it registered by creating a reference to it in the VS IDE?
This is my code:
Code:
Imports JRO
Imports Scripting
Dim je As New JRO.JetEngine
Dim fso As FileSystemObject
Dim fsoFolder As Folder
Dim fsoFile As File
Dim tempName As String
Try
'Make a new File System object.
fso = New FileSystemObject
' Get the FSO Folder (directory) object.
If Len(dirPath) > 0 Then
fsoFolder = fso.GetFolder(dirPath)
For Each fsoFile In fsoFolder.Files
If fsoFile.Name = objGlobal.gDataName Then
Dim sourceConn As String = "Provider=" & objGlobal.gDataProvider & ";Data Source=" & dirPath & "\" & fsoFile.Name & ";"
Dim destConn As String = "Provider=" & objGlobal.gDataProvider & ";Data Source=" & dirPath & "\tempDb.mdb;"
je.CompactDatabase(sourceConn, destConn)
tempName = fsoFile.Name
End If
Next fsoFile
CompactDB = 0
Else
MsgBox("Invalid Path")
CompactDB = -1
End If
Catch ex As Exception
MessageBox.Show(ex.Message, "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Stop)
Finally
fso = Nothing
fsoFolder = Nothing
End Try