Programming ArcObject with VBA

Discussion created by phongbk90 on Aug 19, 2013
Hi all
Everyone can explain this code for me clearly :
I'm trying to select records from the attribute table of a FeatureClass but I get this error when I run this code.
" The Database was not found"
The error point to this line of code : Set pTable = pName.Open
Why I get error at this line?

' Part 1: Define the table.
Dim pWSName As IWorkspaceName
Dim pDatasetName As IDatasetName
Dim pName As IName
Dim pTable As ITable

' Get the dbf file.
Set pWSName = New WorkspaceName
pWSName.WorkspaceFactoryProgID = "esriCore.ShapefileWorkspaceFactory.1"
pWSName.PathName = "d:\LaptrinhGis\Phuhoa\nen\nha_25750"

Set pDatasetName = New TableName
pDatasetName.Name = "phong.dbf"
Set pDatasetName.WorkspaceName = pWSName
Set pName = pDatasetName

' Open the dbf table.
Set pTable = pName.Open