Results 1 to 8 of 8
  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 offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    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.
    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.

  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 offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    You want to see number of total records when table is open? The record navigator at bottom of table shows that.
    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.

  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 offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    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.
    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.

  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 offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    This is an Access table, not a SQL or some other link table? Autonumber field will increment by 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.

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

Similar Threads

  1. Replies: 8
    Last Post: 07-06-2013, 05:13 PM
  2. Increment a number by "1"... once everyday
    By MikeWooZ in forum Reports
    Replies: 10
    Last Post: 12-01-2011, 01:41 PM
  3. Increment number from master table
    By leighturner in forum Queries
    Replies: 1
    Last Post: 12-08-2010, 08:19 AM
  4. Replies: 5
    Last Post: 11-12-2010, 12:10 PM
  5. How to Increment A Number Field
    By Advanced in forum Programming
    Replies: 3
    Last Post: 01-27-2010, 02: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
  •  
Other Forums: Microsoft Office Forums