C
Conan Kelly
Hello all,
Isn't there a simpler way of doing a pseudo-autonumber in a query?
I saw in one post someone mentioned doing a subquery (IncNum: (SELECT
Count(*) FROM thetable As X WHERE X.sortfield <= thetable.sortfield)). That
might work on tables with small number of rows, but I'm working with a table
that has 112,241 records in it. I did a query (Query1) to trim that down to
17,741 records, and then in Query2 I set up my pseudo-autonumber column
based on Query1. Now I'm guessing that for every record in Query2, Query1
would have to be rerun twice on 112,241 records!!! (<--Is that correct?).
Needless to say, it was taking quite a long time to return all records
(don't know how long--didn't bother waiting to see). I just created a temp
table from Query1 and added an actual autonumber column to it.
Is there no function in Access, similar to XL's ROW() function, that could
accomplish this a lot faster (a function that would return the record number
in the record set)? After all, there is a Current Record text box in the
lower left corner of the query results view (in between the first, last,
next, previous, new record buttons). If Access can tell what the current
record number is based on the location of the cursor, you would think that
there would be some function to return the record number.
Thanks for any help anyone can provide,
Conan Kelly
Isn't there a simpler way of doing a pseudo-autonumber in a query?
I saw in one post someone mentioned doing a subquery (IncNum: (SELECT
Count(*) FROM thetable As X WHERE X.sortfield <= thetable.sortfield)). That
might work on tables with small number of rows, but I'm working with a table
that has 112,241 records in it. I did a query (Query1) to trim that down to
17,741 records, and then in Query2 I set up my pseudo-autonumber column
based on Query1. Now I'm guessing that for every record in Query2, Query1
would have to be rerun twice on 112,241 records!!! (<--Is that correct?).
Needless to say, it was taking quite a long time to return all records
(don't know how long--didn't bother waiting to see). I just created a temp
table from Query1 and added an actual autonumber column to it.
Is there no function in Access, similar to XL's ROW() function, that could
accomplish this a lot faster (a function that would return the record number
in the record set)? After all, there is a Current Record text box in the
lower left corner of the query results view (in between the first, last,
next, previous, new record buttons). If Access can tell what the current
record number is based on the location of the cursor, you would think that
there would be some function to return the record number.
Thanks for any help anyone can provide,
Conan Kelly