Solved

Access 2000 - Autonumber in a Query

Posted on 2011-09-26
6
498 Views
Last Modified: 2012-05-12
Dear Experts,

Could you please advise is there way in Access 2000 to add an autonumber to a Query?

My problem is that the query has a certain ordering (in four fields like ascending, descending, descending, descending), and I would like to keep this order.

Basically I have a solution to change the query to make table and after adding Autonumber, but maybe the best would be if the query would be able to do it?

thanks,
0
Comment
Question by:csehz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 20

Assisted Solution

by:clarkscott
clarkscott earned 50 total points
ID: 36598941
You can use the autonumber in a query for sorting/viewing purposes, but you cannot actually add a value to it in an append query.

You would use a WHERE clause for the existing autonumber in your append query and not assign to a field you're adding (let the 'autonumber' function work by itself).

Scott C
0
 
LVL 14

Assisted Solution

by:Bill Ross
Bill Ross earned 50 total points
ID: 36598973
Hi csehz,

You are on the right track but you don't need an autonumber for this.  Sort the records anyway you want in the query and then use the query as the recordsource of your form (or report) whenever you need it.

In MS Access select queries and tables work quite similarly.

Regards,

Bill
0
 
LVL 20

Expert Comment

by:clarkscott
ID: 36598998
Keep in mind - sorting by four fields - you may want to control the 'sort within sort' order.
The sort order should be from left to right - either in a query gui or SQL query.

Scott C
0
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 300 total points
ID: 36600151
"is there way in Access 2000 to add an autonumber to a Query?"
No.
"change the query to make table and after adding Autonumber,"
This is what you can do:

1) Run your Make Table
2) You can now add an Auto Number field to the new table with one line of code:

'Run the MakeTable query first ...
CurrentDb.Execute "YourMakeTableName", dbFailOnError

'Create the Auto Number column
CurrentDb.Execute "ALTER TABLE YourMakeTableName ADD COLUMN ColumnName COUNTER"

where ColumnName is the name you want for the Auto Counter field.

mx
0
 
LVL 84

Assisted Solution

by:Scott McDaniel (Microsoft Access MVP - EE MVE )
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 100 total points
ID: 36600477
If you're looking to just include a "row number' in the query output you might be able to do something like this:

http://allenbrowne.com/ranking.html

See the "Ranking in a Query" section.
0
 
LVL 1

Author Comment

by:csehz
ID: 36707635
Thanks very much the answers, concretely I was able to execute of DatabaseMX advice in the attached database.

LSMConsulting this Ranking query is very inspirating probably yes exactly this is the name what I would like. Just my abilities.. So far was not able to create it, maybe would like to put it in a different question once
KeepOrder.mdb
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
default value of combobox 25 70
Access 2010 Only Including Numbers After Certain Limit 3 45
SQL Query logic question 14 70
Outlook Automation in Access Using "Find" 2 57
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question