Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2014
    Posts
    21

    Adding an autoincrement field to a query.

    Minor question here. I have a table with the quality control measurements for all of our processes and I need to build control charts from it. I can make a query to filter each process and order the measurements by date, but then I need to number each record of the query incrementally in order to draw the control chart (eg. pick measurements from #30 to #50). Is it possible to add a calculated autoincrement field to a query with either QBE or SQL? All information I have found refers to the AUTOINCREMENT type of data for DDL sentences, which I don't need here.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    Its best to do an append to a new table with autonumber field. Queries arent good making autonumbers....they didnt make that a thing.

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,915
    Not an append but an UPDATE to populate a field in table with the desired sequence. Review
    http://www.office-forums.com/update-...s-t703875.html
    http://dbaspot.com/ms-access/392671-...g-sql-vba.html

    Maybe like:

    UPDATE tablename SET fieldname = DCount("*", "tablename", "datefield<#" & [datefield] & "#") + 1
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    Join Date
    Jan 2014
    Posts
    21
    Thanks, I have made the new table for this manipulation purposes. However, I have found the UPDATE instruction takes a significant amount of time to finish. Does the DCount (or any other aggregate function for that matter) function becomes slow when the amount of records is about 150-200?

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,915
    No, should be very fast for so few records. The UPDATE works for me.

    Why would you need a new table?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 6
    Last Post: 02-11-2014, 05:20 AM
  2. AutoIncrement a string
    By Lorlai in forum Forms
    Replies: 1
    Last Post: 04-03-2013, 09:57 AM
  3. AutoIncrement Number
    By burrina in forum Queries
    Replies: 2
    Last Post: 01-30-2013, 08:00 PM
  4. Alphabet autoincrement
    By KWHAT in forum Access
    Replies: 16
    Last Post: 05-23-2012, 08:29 AM
  5. Replies: 1
    Last Post: 05-22-2012, 10:46 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums