This example will demonstrate how to execute an attribute query.
How to use
- Paste the code into your VB6 or VBA Application.
- Call the function from within your application.
Public Function AttributeQuery(pTable As esriGeoDatabase.ITable, _
Optional whereClause As String = "" _
) esriGeoDatabase.ICursor
Dim pQueryFilter As esriGeoDatabase.IQueryFilter
Dim pCursor As esriGeoDatabase.ICursor
' create a query filter
Set pQueryFilter = New esriGeoDatabase.QueryFilter
' create the where statement
pQueryFilter.whereClause = whereClause
' query the table passed into the function and use a cursor to hold the results
Set pCursor = pTable.Search(pQueryFilter, False)
Set AttributeQuery = pCursor
End Function