VB.NET failure referencing MS Access DAO COM Object.

D

Dean R. Henderson

I am trying to reference a MS Access DAO COM object from VB.NET and get the
following error:

System.Runtime.InteropServices.COMException was unhandled
ErrorCode=-2147221164
Message="Retrieving the COM class factory for component with CLSID
{00000100-0000-0010-8000-00AA006D2EA4} failed due to the following error:
80040154."
Source="CompareDatabases"
StackTrace:
at CompareDatabases.DatabaseCompare.tsbInfo_Click(Object sender,
EventArgs e) in C:\My Documents\Visual Studio
2005\Projects\CompareDatabases\DatabaseCompare.vb:line 102
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key,
EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons
button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&
m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd,
Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG&
msg)
at
System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData)
at
System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32
reason, ApplicationContext context)
at
System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason,
ApplicationContext context)
at
Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at
Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at
Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[]
commandLine)
at CompareDatabases.My.MyApplication.Main(String[] Args) in
17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[]
args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

Both the DAO 3.5 and 3.6 DLLs have been registered (using regsvr32.exe).

I have MS Access version 11.0 installed on this system and the project is
referencing DAO version 3.6.

Does anyone have any suggestions about what might not be setup correctly on
my system?

Thanks,

Dean
 
A

Armin Zingler

Dean R. Henderson said:
I am trying to reference a MS Access DAO COM object from VB.NET and
get the following error:

System.Runtime.InteropServices.COMException was unhandled
ErrorCode=-2147221164
Message="Retrieving the COM class factory for component with CLSID
{00000100-0000-0010-8000-00AA006D2EA4} failed due to the following
error: 80040154."
Source="CompareDatabases"
StackTrace:
at CompareDatabases.DatabaseCompare.tsbInfo_Click(Object
sender, EventArgs e) in C:\My Documents\Visual Studio
2005\Projects\CompareDatabases\DatabaseCompare.vb:line 102


Without the soure code in line 102, we can not do anything.

Both the DAO 3.5 and 3.6 DLLs have been registered (using
regsvr32.exe).

I have MS Access version 11.0 installed on this system and the
project is referencing DAO version 3.6.

You don't need MS Access in order to use the Jet engine.


Armin
 
D

Dean R. Henderson

Here is the source:
101: Private Sub tsbInfo_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles tsbInfo.Click

102: Dim DE As New dao.DBEngine

103: Dim DB As dao.Database

104: Dim TD As dao.TableDef

105: DB = DE.OpenDatabase(DBList(6))

106: TD = DB.TableDefs("tblCodeBillingDescription")

107: rtbInfo.Text = TD.Connect

108: DB.Close()

109: DB = Nothing

110: End Sub

The error is reported when creating the New dao.DBEngine object.

Dean
 
D

Dean R. Henderson

That was what I needed.

Just before reading your reply, I tested on another computer I have that is
a 32 bit CPU and it worked fine.

So, once I changed the target CPU to x86, it works without an error.

In my case, I found the way to change this was a little different than the
post.

Project -> [ProjectName] Properties... -> Compile tab and then click the
Advanced Compile Options... button. At the bottom of the dialog, I changed
the Target CPU to x86 and problem solved.

Thanks!!!

Dean
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top