Results 1 to 2 of 2

Thread: rs.MoveLast freezes after a complex SQL statement.

  1. #1

    Thread Starter
    Addicted Member mepaco's Avatar
    Join Date
    Mar 2002
    Location
    Jackson, MS
    Posts
    185

    rs.MoveLast freezes after a complex SQL statement.

    I am executing a SQL query that is rather complex because it has to do with overlapping parts on a computer board. After the SQL statement the next thing I do is move the recordset to the last record, but it freezes. Here is the code:

    VB Code:
    1. Set rs1 = db.OpenRecordset("Select TVia.X, TVia.Y From TVia, TCompPad, TPadStackPads
    2. Where TVia.X Between TCompPad.X + XOffset - (Width / 2) And TCompPad.X + XOffset + (Width / 2) And
    3. TVia.Y Between TCompPad.Y + YOffset - (Height / 2) And TComPad.Y + YOffset + (Height / 2) And
    4. Layer = 1 And TCompPad.PadID = TPadStackPads.PadID", vbOpenSnapshot)
    5.  
    6. rs1.MoveLast

    The program runs through the SQL statement fine, and pretty quickly. However, it freezes as soon as it hits the .MoveLast. I was wondering if anybody had any ideas as to why it would be hanging up on that statement.
    mepaco, hater of all copy machines!

  2. #2
    Frenzied Member
    Join Date
    Jul 2002
    Posts
    1,370
    No surprise there. It has to process all of the recordset to get to the last.

    What the DB engine is doing: return the first rows matching the query because it is a complex one. Usually the prefetch queue is 10 or 20 rows - that's how many are returned for messy queries.
    Blame it on the optimizer.

Posting Permissions

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



Click Here to Expand Forum to Full Width