Strange COM error
-
In an ActiveX dll have an object called Merge, and its method called Import has rudimentary error handling. The basics of Import are shown below. When I call Import from a client, whether I’m connected to the .dll or to the .vbp, with an incorrect database or table name, I get the following error: Method ‘Import’ of object ‘_Merge’ failed. Now if I put a break point on my ‘Err.Raise’ line, execution stops there, but when I single step, it returns to the client project with the above error. If, when stopped on that line, I paste it into the immediate window, I get a good error message. Could this maybe have to do with the fact that the project used to be an ActiveX .exe, and I just recompiled it as a .dll? Public Function Import(ExecuteDatabase As String, PropagateDatabase As String, TableName As String, FileName As String) As Boolean Dim strServer As String Dim strDatabase As String Dim flgTrans As Boolean On Error GoTo ErrProc Import = False 'Connect to configured server and database. Set objSrv = New SQLServer strServer = QueryProfile("Database", "Server", "(local)") strDatabase = QueryProfile("Database", "Database", "cc_online") objSrv.Connect strServer, "sa", "" Set objDb = objSrv.Databases(strDatabase) Set objTable = objDb.Tables(TableName) ... ... ... Exit Function ErrProc: Err.Raise vbObjectError + 2000, "Merge.Import", "Import for table " & TableName & " failed: [" & Err.Description & "]" End Function