Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Auto Number rows

Status
Not open for further replies.

Ebes1099

Technical User
Jul 8, 2009
156
US
Is there a way that I can create a field that will auto number the rows in a continuous form I'm using. I have a subform on a form, the subform is based on a query and I want to be able to number the rows. Any ideas?
 
You can number the rows using a query. I assume you want a dynamic number. Here is an example. You may need to provide your query for a better example.

Code:
select count(B.fldTwo) +1 as LineNumber
     , A.fldTwo
     , A.fldOne
  from tblOne as A
left outer
  join tblOne as B
    on A.fldThree = B.fldThree 
   and (
       A.fldTwo > B.fldTwo
    or A.fldTwo = B.fldTwo
   and A.fldOne > B.fldOne
       )   
group 
    by A.fldTwo
     , A.fldOne
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top