Error from AccessWorkspaceFactory.Create

Discussion created by johnfritzen on May 30, 2012
Latest reply on Jun 8, 2012 by johnfritzen

For the following code....
 Dim pWorkspaceName As ESRI.ArcGIS.Geodatabase.IWorkspaceName
 Dim pWorkspaceFactory As ESRI.ArcGIS.Geodatabase.IWorkspaceFactory
 'Set up new database
 pWorkspaceFactory = New ESRI.ArcGIS.DataSourcesGDB.AccessWorkspaceFactory
 pWorkspaceName = pWorkspaceFactory.Create("C:\Temp", "foo.mdb", Nothing, 0)

I get the error...
System.Runtime.InteropServices.COMException was caught
  Message=Exception from HRESULT: 0x80040213
       at ESRI.ArcGIS.DataSourcesGDB.AccessWorkspaceFactoryClass.IWorkspaceFactory2_Create(String parentDirectory, String Name, IPropertySet ConnectionProperties, Int32 hWnd)

I am using vs2010 and ArcMap 10. 
The code is in a windows form.  The form is called from a ICommand class.  My code was converted from VB6 and ESRI 9.x.

When I am debugging, this line and step into it

pWorkspaceFactory = New ESRI.ArcGIS.DataSourcesGDB.AccessWorkspaceFactory

It goes to the Deactivate subroutine of the Form code.

Thanks for your help!