Skip to main content

Error number 51 - Unable to find a schema in database.

Hi Brian,
 
I get a strange Error message: "Analysis_PU_02_Duplicate_Name_Address_VATNumber",51,"Unable to find a schema in database."
 
I executed my script several times and 2 out of 5 times I get said error.
I always execute the script from the same folder and have the same working folder.
 
Here is my Code:
 
Function Analysis_PU_02_Duplicate_Name_Address_VATNumber
        On Error GoTo ErrHandler 
        Dim dbname As String
        Dim finname As String
 
        finname = "PU_02_Duplicate_Name_Address_VATNumber"
 
        dbname = workingdirectory + "\03 Results\VendorMaster_without_Employees.IDM"
        If fileexists(dbname)=false Then
              Call Analysis_VendorMaster_without_Employees
        End If
 
        Set db = Client.OpenDatabase(dbname)
        Set task = db.DupKeyDetection
        task.DisableProgressNotification = True
        task.IncludeAllFields
        task.AddKey "NAME_1", "A"
        task.AddKey "CITY", "A"
        task.AddKey "POSTAL_CODE", "A"
        task.AddKey "HOUSE_NUMBER_AND_STREET", "A"
        task.AddKey "VAT_REGISTRATION_NUMBER", "A"
        task.OutputDuplicates = TRUE
        dbName = workingdirectory + "\03 Results\" + finname + ".IDM"
        task.PerformTask dbName, ""
 
        Client.CloseAll
 
        Dim copycomplete As Boolean
        copycomplete = moveIt(finname, "Duplicate Name Address VATNumber")
 
        Set task = Nothing
        Set db = Nothing
 
        Exit Function
ErrHandler:
        If Err.Number = 0 Then
              Write #1, Now, " - ERROR - " , "Analysis_PU_02_Duplicate_Name_Address_VATNumber", Err.Number, Err.Description, "Error Not defined"
        Else
              Write #1, Now, " - ERROR - " , "Analysis_PU_02_Duplicate_Name_Address_VATNumber", Err.Number, Err.Description
        End If
        errorOccurred = TRUE
        'resume next
 
End Function
 
Have you ever had this error message? Any thoughts on how to fix it?
 
Thanks in advance,
Steve
 

Brian Element Thu, 03/20/2014 - 19:19

Steve, which version of IDEA are you using?  If you get the error does your code still process properly?

Also you might try removing the OnError Goto for testing.  This way the script will stop and display the line that it stopped on, this might give a bit more information on what is exactly causing the error, such as is it with the task or one of the functions you are calling.

Steve Fri, 03/21/2014 - 04:49

Hi Brian,
 
I'm using IDEA v8 (but we want to update to v9 soon). Yes, my code processes properly when the error occurs.
 
I now removed the OnError GoTo line and located the error. The line is:
    task.DisableProgressNotification = True
*  task.IncludeAllFields
    task.AddKey "NAME_1", "A"
 
It seems to me that the error is not an error in the script but in IDEA itself(Because it occurs randomly, even when I run it several times from the same folder with the same data and so on). What do you think?
Best regards, Steve

Brian Element Fri, 03/21/2014 - 06:28

Steve, I would have the tendancy to agree with you.  If the script is working properly each time and you only get the error occasionaly then it might be a false error.  I can't see anything in your code that would cause an error so it looks like this might just be an IDEA quirk that can be ignored, especially when your code is running with no real errors.