Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2004
    Location
    belgium
    Posts
    290

    Arrow Unanswered: sorting recordsets

    the general set up of this Db is :

    front_end
    back_end

    tables are opend as dynaset

    to search one particular table(A), i need to sort it on a single field, and on multiple fields (indexes would be nice but not allowed with dynasets).

    when i want to loop through one table (B) from beginning to end, i have to find some values in the sorted table (A).

    first i sort tabel A like this

    pRstArt.Sort = "artnaam"
    Set pRstArt = pRstArt.OpenRecordset

    ..... do some finding

    the i sort it again like this

    pRstArt.Sort = "Size", "Quantity", "Reserved"
    Set pRstArt = pRstArt.OpenRecordset

    do some finding
    and caluculations

    return to table B
    movenext in table B

    and so on

    after a few times (lets say 6x)

    I get the error (simplyfied) "Nested to deep."

    Why, and how to cure this ?

    emiel

  2. #2
    Join Date
    Mar 2004
    Location
    belgium
    Posts
    290
    anybody ????

  3. #3
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    If pRstArt is a recordset then when you do the command :

    Set pRstArt = pRstArt.OpenRecordset

    You are creating a second recordset, but stil using the first recordset variable. Are you trying to call the recordset recursively? If you are not intending to call it recursively then I would create another recordset variable to hold the sorted results of the first recordset.

    pRstArt - would be the results of the recordset
    pRstArtSort - would be for anytime you sorted pRstArt

    pRstArt.Sort = Whatever
    Set pRstArtSort = pRstArt.OpenRecordset
    'Do stuff
    pRstArtSort.Close

    'Do the next sort
    pRstArt.Sort = Whatever
    Set pRstArtSort = pRstArt.OpenRecordset
    'Do stuff
    pRstArtSort.Close


    Whenever you use OpenRecordset it creates another recordset object. You should have a second variable to hold the results.

  4. #4
    Join Date
    Mar 2004
    Location
    belgium
    Posts
    290
    thanks DCKunkle

    I don´t call it recursively, however my thaughts were when using the same recordset variable would save memory and a lot of program-lines (in this particular application), but i think that the pRstartSort.Close, which I wasn´t using, will eliminate the error, i will soon find out.

    emiel

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •