Just trying out some of our old VBA code ArcGIS 10 and getting a type mismatch error where I should NOT be getting one.
Here is the code:
Dim DS as IDataSet
Set DS = MyTable
Dim TableName As IName
Set TableName = DS .FullName
The error is thrown at "Set TableName = DS.FullName"
Where TableName is IName and DS.FullName is IName.
This should not throw a Type Mismatch error but it is, and only in ArcGIS 10; all other previous versions work.
Just trying out some of our old VBA code ArcGIS 10 and getting a type mismatch error where I should NOT be getting one.
Here is the code:
Dim DS as IDataSet
Set DS = MyTable
Dim TableName As IName
Set TableName = DS .FullName
The error is thrown at "Set TableName = DS.FullName"
Where TableName is IName and DS.FullName is IName.
This should not throw a Type Mismatch error but it is, and only in ArcGIS 10; all other previous versions work.
Dim mxd As IMxDocument Set mxd = ThisDocument Dim map As IMap Set map = mxd.FocusMap Dim tabcoll As ITableCollection Set tabcoll = map Dim tabl As ITable Set tabl = tabcoll.Table(0) Dim DS As IDataset Set DS = tabl Dim TableName As IName Set TableName = DS.FullName Dim dsName As IDatasetName Set dsName = TableName Debug.Print dsName.Name
I gave this a try on ArcGIS 10 SP5 and it worked ok... The table was an Oracle table accessed through SDE. In the original code, I noticed a space between the "DS" and ".FullName", probably just a copy/paste issue... When converting VBA code from 9.3 mxds to 10, originally, I noticed that many of my references where pooched. I had to go to tools, references and remove the missing ones, then it worked ok. It seems VBA stops loading references as soon a it gets to a missing one, so if the one you need is after that in the list, it doesn't work.Dim mxd As IMxDocument Set mxd = ThisDocument Dim map As IMap Set map = mxd.FocusMap Dim tabcoll As ITableCollection Set tabcoll = map Dim tabl As ITable Set tabl = tabcoll.Table(0) Dim DS As IDataset Set DS = tabl Dim TableName As IName Set TableName = DS.FullName Dim dsName As IDatasetName Set dsName = TableName Debug.Print dsName.Name
' Loop through the codepoint layer Set pDataset = pdatasets.Next Do While Not (pDataset Is Nothing) ' MsgBox (pDataset.Name) Select Case pDataset.Type Case esriDTFeatureClass Select Case pDataset.BrowseName Case "OS_VECTOR.OS_CODEPOINT" Set pName = pDataset.FullName ===========FAILS HERE ============== Set m_pCodePointClass = pName.Open 'Set pFCcodepoint = pName.Open 'MsgBox (pFCcodepoint.ShapeType) End Select End Select Set pDataset = pdatasets.Next Loop