Results 1 to 8 of 8

increment number in first column

  1. #1
    learning_graccess is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Oct 2011
    Posts
    40

    increment number in first column

    I have a table where in first column "id" has serial nos. not in order. Now I want to update the column in the table with a query from (serial no. 1 and it should increment by 1 upto last row. How I can write query?

  2. #2
    June7's Avatar
    June7 is online now Moderator
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    26,805
    Order in table should not matter. Why do you want to do this? I don't think an UPDATE query can do this. Would need VBA code.
    To provide db: Make copy, remove confidential data, run compact & repair, zip if large - 2mb allowed, attach to post. Attachment Manager is below the Advanced post editor window.
    If suggestion in this post resolves your issue, please use the Thread Tools and mark the thread as Solved!

    Debug!Debug!Debug! http://www.cpearson.com/excel/debug.htm

  3. #3
    learning_graccess is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Oct 2011
    Posts
    40
    Yes it is not important but it helps to see total number of records in a table at ease. I don't know how to use and run vba code at all.

  4. #4
    June7's Avatar
    June7 is online now Moderator
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    26,805
    You want to see number of total records when table is open? The record navigator at bottom of table shows that.
    To provide db: Make copy, remove confidential data, run compact & repair, zip if large - 2mb allowed, attach to post. Attachment Manager is below the Advanced post editor window.
    If suggestion in this post resolves your issue, please use the Thread Tools and mark the thread as Solved!

    Debug!Debug!Debug! http://www.cpearson.com/excel/debug.htm

  5. #5
    learning_graccess is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Oct 2011
    Posts
    40
    yes I know that. But still I just wanted to know if I can change and correct the SR. no.. Now it's not in proper order, the last row Sr. no. is 3556 but at record navigator it shows (2780). That shows there are some nos. are missing.

  6. #6
    June7's Avatar
    June7 is online now Moderator
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    26,805
    The Serial number is an autonumber datatype? Is this the primary key used as foreign key in other tables. If so, DO NOT try to change. If it is not the primary key field, you can delete the autonumber field and then create a new one.
    To provide db: Make copy, remove confidential data, run compact & repair, zip if large - 2mb allowed, attach to post. Attachment Manager is below the Advanced post editor window.
    If suggestion in this post resolves your issue, please use the Thread Tools and mark the thread as Solved!

    Debug!Debug!Debug! http://www.cpearson.com/excel/debug.htm

  7. #7
    learning_graccess is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Oct 2011
    Posts
    40
    Yes it is not used as foreign key in any other table. I can delete the column, but how I can add it again with increment in access?

  8. #8
    June7's Avatar
    June7 is online now Moderator
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    26,805
    This is an Access table, not a SQL or some other link table? Autonumber field will increment by 1.
    To provide db: Make copy, remove confidential data, run compact & repair, zip if large - 2mb allowed, attach to post. Attachment Manager is below the Advanced post editor window.
    If suggestion in this post resolves your issue, please use the Thread Tools and mark the thread as Solved!

    Debug!Debug!Debug! http://www.cpearson.com/excel/debug.htm

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

Similar Threads

  1. Replies: 8
    Last Post: 07-06-2013, 04:13 PM
  2. Increment a number by "1"... once everyday
    By MikeWooZ in forum Reports
    Replies: 10
    Last Post: 12-01-2011, 11:41 AM
  3. Increment number from master table
    By leighturner in forum Queries
    Replies: 1
    Last Post: 12-08-2010, 06:19 AM
  4. Replies: 5
    Last Post: 11-12-2010, 10:10 AM
  5. How to Increment A Number Field
    By Advanced in forum Programming
    Replies: 3
    Last Post: 01-27-2010, 12:36 PM

Posting Permissions

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