This error happens at the db = client.Database() line of code below:
Dim NewSearch As LFSearch
Dim AllHits As ILFCollection
Dim Hit As LFSearchHit
Dim EntryHit As ILFEntry
Dim Doc As LFDocument
Dim strPathName As String = ""
Dim strParentFolder As String = ""
Dim db As LFDatabase
Dim client As New Object
Dim ClonedConn As New LFConnection
Dim LFImageEnable As New LFIMAGEENABLE80Lib.ImageEnable
Dim bOpen As Boolean
' Checks whether the Laserfiche client is open.
bOpen = CBool(LFImageEnable.IsLaserFicheOpen)
If Not bOpen Then
LFImageEnable.LoadLaserFiche(True)
'Login to Laserfiche
LFImageEnable.Login(DATABASE_NAME, LF_SERVER, USER_NAME, USER_PASSWORD, 2)
Else
Try
'Work-around to avoid error 6000 with every other scan
LFImageEnable.Logout()
LFImageEnable.Login(DATABASE_NAME, LF_SERVER, USER_NAME, USER_PASSWORD, 2)
Catch ex As Exception
Select Case ex.Message
Case "External component has thrown an exception."
LFImageEnable.Login(DATABASE_NAME, LF_SERVER, USER_NAME, USER_PASSWORD, 2)
Case Else
Throw New Exception(ex.Message)
End Select
End Try
End If
'Set the integration folder
INTEGRATION_FOLDER = Microsoft.Dexterity.Applications.Dynamics.Globals.IntercompanyId
'Access an open Laserfiche client and clone connetion
Try
client = GetObject(Nothing, "LFClient.Document")
Catch ex As Exception
Throw New Exception("The Laserfiche client is not open.")
End Try
'Get its connection
Try
db = client.Database()
Catch ex As Exception
Throw New Exception("You are not logged into a database.")
End Try