Row Number or AutoNumber?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there any way to create a row number in a query? For in example, in Excel
you can just do a =ROW() to get the row number, anything like this in Access?
 
The typical method is to use a ranking subquery. For instance if you want to
number the Customers in the Northwind.mdb you could create a query like:

SELECT (SELECT Count(*) FROM Customers C where C.CustomerID
<=Customers.CustomerID) AS RecordNum, Customers.*
FROM Customers
ORDER BY Customers.CustomerID;
 
Continuing from the example below...

What if you wanted to create a Transaction Number within a table where a
customer could be listed multiple times? Is there a way to get a unique row
number for each record, even for the duplicate customer ID's?
 
You would have to have something unique that you could use for ranking. You
must have a field or fields that you would look at to rank. Use these fields.
 
Okay, Thanks. I'm using a datasource with I have no comtrol over, and
therefore cannot assign a unique field (aside from putting into a new access
table with an autonumber). My back up plan was to concatenate multiple
fields in order to make the row unique as you suggest below. I just wanted to
be sure there wasn't a cleaner way to do this (i.e. certain function, etc).

Thanks, very helpful!
 
Back
Top