Showing posts with label error. Show all posts
Showing posts with label error. Show all posts

Friday, 8 March 2019

Altium Unable to cast COM object type

Summary
This blog describes how Altium users can resolve the "Unable to cast COM object type" which can be caused as a result of installing / uninstalling Office (32 bit) software together with Office (64 bit).

Altium Dialog Message
The "Unable to cast COM object type" message can be displayed when there is a requirement for Altium to use Excel libraries, such as generating a Bill of Materials (BOM).


Altium Dialog Message
Altium Dialog Message
The message identifies a registry entry which is located at HKCR\TypeLib.

Causes
One Microsoft blog explains that the message may be displayed within Office applications when a mixture of Office 32/64 bit applications are installed on the same machine. The Microsoft blog suggests removing the HKCR key 
00020813-0000-0000-C000-000000000046 although applying this change with Altium did not resolve the issue.


Registry 00020813-0000-0000-C000-000000000046 Entry
Registry 00020813-0000-0000-C000-000000000046 Entry
Office Repair
To remedy the issue in Altium, an Office Repair was required. With the Altium application closed, may not be necessary, the Apps and Features application was opened from the 'Start' menu and the relevant Office installation selected.


Windows 10 Apps and Features
Windows 10 Apps and Features
The Modify button was selected followed by the Quick Repair.


Office Quick Repair
Office Quick Repair
Quick Repair Started
Quick Repair Started
In a few minutes the repair finished.


Quick Repair Finished
Quick Repair Finished
After the repair Altium was launched and a BOM generated without any issues.

Other Altium Messages
While replicating the "Unable to cast COM object type" Altium message for this blog, the process of installing 32 bit Office software did interfere with another Microsoft redistributable. This resulted in Altium displaying a dialog detailing the missing redistributable. Fortunately the Altium dialog provided a link to the Microsoft website where an installation of the redistributable resolved the issue.

Tuesday, 31 October 2017

Altium kb4041681 JET database fix for unexpected error

Summary
This blog illustrates how Altium users may be able to resolve the issue created by Microsoft KB4041681, which causes a problem with JET databases in Altium: “Unexpected error from external database driver (1). (Microsoft JET Database Engine). This results in Altium being unusable - until the Microsoft update is rolled back.

Microsoft Updates
As part of Microsoft's October patch and rollout, changes were made breaking the long deprecated JET database. This has been tracked in numerous blogs such as blogs.msdn.microsoft.comFor Altium Dblib users the recommended change was mentioned in the KB4041681 release. There are two methods suggested below for resolving the issue in Altium.

My Windows 10 work computer is connected to a domain and ergo a group policy. Permanently blocking KB4041681 is not a reasonable solution when a group policy is applied to each computer, however for a Altium system originally built on Protel 99, this is fixable.


Altium.Dblib
Users Dblib file
To start the process, Altium is launched and the appropriate Dblib file located and opened.

Just beneath the source of connection section in the Altium dialog box, the JET database error message is shown.


Altium JET database error
Altium JET database error
For the methods listed below users should use the appropriate link in place of the text <my Altium excel file>.

Method 1: Changing to Excel 2007
As highlighted by the helpful folks on the EEVBlog forums the file type can be changed to Excel 2007. Older systems such as mine used Excel 2003. Changing is achieved using the drop down list box, as shown below, "Select Database Type" from Microsoft Excel to Microsoft Excel 2007.

Setting for Excel file
Setting for Excel file
Any associated Excel files(s) would need to be saved in the new .xlsx format.


Setting for Excel 2007 file
Setting for Excel 2007 file

Method 2: Changing from JET
The second method changed the database. This can my ascertained by reading the Microsoft 'kb' release which states "Download and install the Microsoft Access Database Engine 2010 Redistributable, and then modify the DB connection strings in Microsoft Excel to use ACE as a provider. Example: Change Provider=Microsoft.Jet.OLEDB.4.0 to Provider=Microsoft.ACE.OLEDB.12.0."

The connection type is changed by selecting "Use connection String" instead of "Select Database Type".

Connection string for JET in Altium
Connection string for JET in Altium
This connection string however, uses the older JET database so the Microsoft.ACE.OLEDB.12.0 is used to replace the Microsoft.Jet.OLEDB.4.0. The provision is that the database engine redistributable listed by Microsoft is installed.

Connection string for ACE in Altium
Connection string for ACE in Altium
At the same time the Excel file is saved as the newer format ".xlsx".

Testing
After saving the updated Dblib file, Altium was launched again. There were no immediate issues placing components in the schematic.

This is by no means the solution for all Altium users. The methods listed in this blog has been tested briefly on a Win 10 Pro machine running Altium 17.1.6 with all Windows updates applied.

Addendum
During testing of the solution listed above, some users noted an additional OLE related exception shown by Altium. A window similar to the image below was displayed when trying to connect to the database.


Altium database OLE exception
Altium database OLE exception
This is a known issue that has been documented by a number blog sites such as PCBParts. If an Altium Database File of type DbLib is being used, opening the file from within Altium may show a similar image to that shown below. 

First step is to backup the DbLib file. 


Altium database connection failed
Altium database connection failed
The second step, install an Office 2007 System Driver as provided from the PCBParts blog. This is one known fix.

After installation of the Office 2007 driver two results were reported. Either no further issues were seen or the Altium Database File was overwritten such that previous information about the database structure was removed - fixed by copying the DBLib file backup from the first step.