How to get exactly row 6 from a SELECT result in Access 2000 SQL?
How can I get exactly row 6 or whatever, row 234 from simple SELECT statement in Access 2000 SQL?
Re: How to get exactly row 6 from a SELECT result in Access 2000 SQL?
You don't, since access doesn't have a ROW_NUMBER-Function.
See your other thread.
I've told you there is a workaround using DCOUNT
EDIT: There is a second workaround i just thought of:
You could use the TOP n -function, and then retrieve the last recordset, but obviously, this would only work on sorted queries (ORDER BY-clause)
rs.open "SELECT TOP 6 ID, clientname FROM myclient ORDER BY Turnover",blahblah
rs.movelast
Re: How to get exactly row 6 from a SELECT result in Access 2000 SQL?
If you are using vba code. Open the recordset, and put a while loop in to move to next recordset until the number is reached or there are no more records.
If I remember correctly there was a method to jump straight to a specific x row method. found it!
Don't usually use it but perhaps this is what you were loking for (Note its DAO)
Re: How to get exactly row 6 from a SELECT result in Access 2000 SQL?
in ADO the move method should do what you want, move # records from bookmark adbookmarkfirst
Re: How to get exactly row 6 from a SELECT result in Access 2000 SQL?
It doesn't matter which "workaround" he uses, in the worst case it's going to be a performance-issue.
He'll always have to retrieve the full Query (a few thousand records?), and then in a second step move to the desired record.
Re: How to get exactly row 6 from a SELECT result in Access 2000 SQL?
Quote:
He'll always have to retrieve the full Query
bad table design?
Re: How to get exactly row 6 from a SELECT result in Access 2000 SQL?
Quote:
Originally Posted by
westconn1
bad table design?
No idea.
But if it's a table with a lot of columns, it might be an idea to split it up into a master-table with just the columns you need for the Query, with a Detail-Table in 1:1 relation.
Meaning: Do the query on the stripped-down master-table, move cursor to desired position, read the ID/PK from that record, retrieve the remaining informations from the detail-table.
But without knowing his setup.... *shrug*
EDIT: If he knows which record (ROW_NUMBER) he needs before firing the query, i think my approach with "SELECT TOP n ....." and then Record.MoveLast would still be his best bet.
Of course, i know that the further in the back the record is he seeks, the more records he has to load.
With TOP n he can at least cut off everything after it