Select to view content in your preferred language

IWorkspaceFactory.Open Fails

1082
4
06-09-2010 02:36 AM
ManuelF_
Deactivated User
What is wrong with this code?

Dim pPropset As IPropertySet
Set pPropset = New PropertySet

Dim pFact As IWorkspaceFactory
Dim pWorkspace As IWorkspace

pPropset.SetProperty "DATABASE", "C:\New Personal Geodatabase.mdb"

Set pFact = New AccessWorkspaceFactory
Set pWorkspace = pFact.Open(pPropset, 0)


Last line gives me Automation Error -2147220952 (80040228)

Thanks for any input.
0 Kudos
4 Replies
ManuelF_
Deactivated User
Never mind. I just realized TOTALLY BY CHANCE that above error code means 'License not initialized'. VBA didn't recognize that error and gave me generic description of 'Automation Error'. BTW where one does find a list of ArcObjects automation error codes?
0 Kudos
RuchiraWelikala
Regular Contributor
Never mind. I just realized TOTALLY BY CHANCE that above error code means 'License not initialized'. VBA didn't recognize that error and gave me generic description of 'Automation Error'. BTW where one does find a list of ArcObjects automation error codes?


It's also good practice to have file paths without spaces.
ArcGIS tends to frown on such things. Good luck
0 Kudos
JamesMacKay
Deactivated User
BTW where one does find a list of ArcObjects automation error codes?


Error codes in ArcObjects are not unique - the meaning of an error depends on the context of the error. For example, there is an enum type in the Geodatabase library that defines the values of Geodatabase error codes known as fdoError, but there are comparable enum types for virtually every other library. In many cases the same numeric values are re-used across multiple libraries.

Here's a utility I built a while back to make life easier:
http://resources.esri.com/arcgisengine/dotnet/index.cfm?fa=codeGalleryDetails&scriptID=16621

Because there are so many error enums in ArcObjects, it uses an XML configuration file to define a subset of types that you're interested in. The default configuration file limits the errors to data access, geometry and (I believe) network errors.
0 Kudos
ManuelF_
Deactivated User
Thank you, mackayj80, I will look at it. I guess every bit helps...
0 Kudos