Public Sub AttributeClause()
    Dim oRecs As CRecords
    Dim oRec As CRecord
   
    Set oRecs = New CRecords
   
    Dim oSQL As String
   
    oSQL = "select ID from RECORDS R "
    oSQL = oSQL & "join CONSTITUENTATTRIBUTES CA on CA.PARENTID = R.ID "
    oSQL = oSQL & "join ATTRIBUTETYPES A on A.ATTRIBUTETYPESID = CA.ATTRIBUTETYPESID "
    oSQL = oSQL & "where A.DESCRIPTION = 'Test Attribute' "
   
    oRecs.Init REApplication.SessionContext, tvf_record_CustomWhereClause, "ID in (" & oSQL & ")", True
   
    For Each oRec In oRecs
   
        Debug.Print oRec.Fields(RECORDS_fld_FULL_NAME)
   
        oRec.Closedown
        Set oRec = Nothing
    Next oRec
   
   
    oRecs.Closedown
    Set oRecs = Nothing

End Sub

Make sure to closedown your objects when using for loops!