Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 5th, 2005, 12:50 PM
Authorized User
 
Join Date: Mar 2005
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default Autonumber in a query

Is there a way to compute an autoincrement number field in a query, which start to number from 1 and finnish with the last record number of query(for ex, in a query with 150.000 records autoincrement number will be 1,2,....150.000). Thanks!

 
Old May 6th, 2005, 07:48 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

You don't actually want this in the query, do you? Perhaps you want it to show up in a report. If that is the case, do this:

Create a report based on your query, and add an unbound text box control to the detail section, with the following control source setting: =1

Change the running sum property for the control to Over Group, or Over All.

If you want to create a new table from your query so that it generates a new PK, that is a different issue. You can just create the table from the query, and then add an autonumber field to the table, and it will automatically populate.

mmcdonal
 
Old May 11th, 2005, 07:58 AM
Authorized User
 
Join Date: Mar 2005
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks,mmcdonal! Your solution with the running sum on a report works great! Thanks again!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Autonumber problem mankoti_mankoti2000 Access 6 August 29th, 2006 12:28 AM
Autonumber Query Brendan Bartley Access 2 July 16th, 2006 02:14 AM
AutoNumber Assignments jackDaniels SQL Server 2000 10 February 10th, 2005 12:32 AM
regarding Autonumber... MuthuAL Classic ASP Databases 2 December 8th, 2004 08:04 AM
AutoNumber Conundrum enterbase Access VBA 4 January 28th, 2004 05:29 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.