Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 5th, 2005, 12:50 PM
Authorized User
Join Date: Mar 2005
Location: , , .
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!

Reply With Quote
  #2 (permalink)  
Old May 6th, 2005, 07:48 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts

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.

Reply With Quote
  #3 (permalink)  
Old May 11th, 2005, 07:58 AM
Authorized User
Join Date: Mar 2005
Location: , , .
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts

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

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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

All times are GMT -4. The time now is 01:57 PM.

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