Retrieve ordered audit records

Public Sub GetModifiedRecords()
    Dim tdReqs As TDAPIOLELib.List

    Dim aReq As Req
    Set tdReqs = RetrieveOrderedRecords("10/10/2004 16:13:31", "01/09/2006 17:41:05")
    If tdReqs Is Nothing Then
        MsgBox "No records retrieved"
        For Each aReq In tdReqs
            With aReq
                Debug.Print .Path, .Name, .Modified
            End With
    End If
End Sub

Private Function RetrieveOrderedRecords _
    (ByVal sinceDate As Date, _
     ByVal currentSyncDate As Date) _
        As TDAPIOLELib.List

' Retrieve sorted requirements by version date

On Error GoTo ErrorHandler:

    Dim m_filter As TDAPIOLELib.TDFilter
    Dim oReqFactory As TDAPIOLELib.ReqFactory
'tdc is a TDConnection object. The user is authenticated and
' connected to a project before this routine is run.
    Set oReqFactory = tdc.ReqFactory
    Debug.Assert Not oReqFactory Is Nothing
    Set m_filter = oReqFactory.Filter
    Debug.Assert Not m_filter Is Nothing
' Query criteria
    m_filter.Filter("RQ_VTS") = "> " & Chr(34) & Format(sinceDate, "yyyy-mm-dd hh:mm:ss") & Chr(34) & _
                    " AND <> " & Chr(34) & Format(currentSyncDate, "yyyy-mm-dd hh:mm:ss") & Chr(34)
' Sort by path to get parent requirements in list before children.
    m_filter.order("RQ_REQ_PATH") = 1
    m_filter.OrderDirection("RQ_REQ_PATH") = TDAPIOLELib.TDOLE_ASCENDING
' Sort by version time stamp so earlier records output first.
    m_filter.order("RQ_VTS") = 2
    m_filter.OrderDirection("RQ_VTS") = TDAPIOLELib.TDOLE_ASCENDING
' Return the list.
    Set RetrieveOrderedRecords = m_filter.NewList
    Exit Function
    ErrHandler err, "RetrieveOrderedRecords"
End Function