Do Until IsEmpty Error - VBA to

Discussion created by snowgirl62 on Apr 9, 2012
Latest reply on Apr 10, 2012 by jtkknelson
Despite the fact that I am a novice, I'm looking to upgrade some coding from VBA to  I literally have gone from 102 errors, down to 1 - and am stuck! 

This small section essentially searches through a table which has multiple inspection locations and each location can have several inspection dates. I need to query that table in ArcMap to find all the unique inspection locations and the most recent inspection date for that location.  The original coding (that I had incredible help with developing thanks to the forums!!) worked beautifully for 2 years, but I'm running into an issue now with the 'Do Until IsEmpty (value)' line.  I'm getting an error message that "Name 'IsEmpty' is not declared".  Any ideas??

The original coding is as follows:

Sub SelectRecordsForMaxFieldValue_Inspections() 'selects all unique inspections from "Inspections.shp" and most recent date
        Dim pMxDoc As IMxDocument
        Dim pFLayer As IFeatureLayer
        Dim pData As IDataStatistics
        Dim pCursor As ICursor
        pMxDoc = My.ArcMap.Document
        pFLayer = pMxDoc.FocusMap.Layer(1) 'change the index according to the layer of interest
        pCursor = pFLayer.Search(Nothing, False)

        'Create the new table that the selected records will populate.
        pData = New DataStatistics
        pData.Field = "typeAndNum" 'change to match FC attribute with multiple records
        pData.Cursor = pCursor 'this is the same cursor created above

        Dim pEnumVar As IEnumVariantSimple

        Dim value As Object

        pEnumVar = pData.UniqueValues

        value = pEnumVar.Next

        Dim pFeatureSelection As IFeatureSelection
        pFeatureSelection = pFLayer 'QI

        Dim pActiveView As IActiveView
        pActiveView = pMxDoc.ActiveView

        Do Until IsEmpty(value)
            Dim pQF As IQueryFilter
            pQF = New QueryFilter
            pQF.WhereClause = "typeAndNum = '" & value & "'" 'change to match FC attribute with multiple records
            Dim pFc As ICursor
            Dim pTable As ITable
            pTable = pFLayer
            pFc = pTable.Search(pQF, False)
            Dim pDataStats1 As IDataStatistics
            pDataStats1 = New DataStatistics
            pDataStats1.Field = "dt_stamp" 'FC attribute you want the most recent value of
            pDataStats1.Cursor = pFc
            Dim pDataStatResults1 As IStatisticsResults
            pDataStatResults1 = pDataStats1.Statistics

            'Create the query filter
            Dim pQueryFilter As IQueryFilter
            pQueryFilter = New QueryFilter
            pQueryFilter.WhereClause = "typeAndNum = '" & value & "' AND dt_stamp = date '" & Format(pDataStatResults1.Maximum, "MM/DD/YYYY") & "'"

            pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, Nothing, Nothing) 'Flag original selection
            pFeatureSelection.SelectFeatures(pQueryFilter, esriSelectionResultEnum.esriSelectionResultAdd, False) 'Perform the selection
            pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, Nothing, Nothing) 'Flag the new selection

            value = pEnumVar.Next

Thanks in advance for any help/ideas!