Results 1 to 12 of 12
  1. #1
    KramerJ is offline Novice
    Windows XP Access 2003
    Join Date
    Mar 2009
    Location
    Las Vegas, NV
    Posts
    15

    Assign A Sequential Number To A Table Row


    I have a table that has four fields and 39k rows. The first field is for the sequential number. The fourth field has a different entry varing from the 177th to 185th row. Using VBA how can I seqentially insert a number from 1 to n based on the fourth field entry. Please help.

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I would look into Stephan Lebans solution.

  3. #3
    KramerJ is offline Novice
    Windows XP Access 2003
    Join Date
    Mar 2009
    Location
    Las Vegas, NV
    Posts
    15

    Assign A Sequential Number To A Table Row

    Thanks RG for you reply. I am not that versed in VBA, but will the code I looked at in the Lebans' site serialize all the row's start to end or will the 'keyname' be used for my 4th field condition to restart the serialize function. (ex. Serial # 1-177, field 4 = xxyyxx // Serial 1-177, field 4 = zzxxyy,,etc.)

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Serialize the Recordset from beginning to end. I guess I do not understand what you need. I don't understand this:
    (ex. Serial # 1-177, field 4 = xxyyxx // Serial 1-177, field 4 = zzxxyy,,etc.)
    Where is the Serial #?

  5. #5
    KramerJ is offline Novice
    Windows XP Access 2003
    Join Date
    Mar 2009
    Location
    Las Vegas, NV
    Posts
    15
    RG - (Field-1) Serial # 1-177, field 4 = xxyyxx // Serial 1-177, field 4 = zzxxyy,,etc.)

    Field-1 Field-2 Field-3 Field-4
    1 xx xx xxyyxx
    . xxyyxx
    177 xxyyxx
    1 zzxxyy
    . zzxxyy
    177 zzxxyy
    ......and so on

    sorry for the confusion and not explaining clearly. Does this help.
    Thanks,

  6. #6
    KramerJ is offline Novice
    Windows XP Access 2003
    Join Date
    Mar 2009
    Location
    Las Vegas, NV
    Posts
    15
    RG - Lost the formatting in my last post, I will try again...

  7. #7
    KramerJ is offline Novice
    Windows XP Access 2003
    Join Date
    Mar 2009
    Location
    Las Vegas, NV
    Posts
    15
    1. RG - (Field-1) Serial # 1-177, field 4 = xxyyxx // Serial 1-177, field 4 = zzxxyy,,etc.)


      Field-1 Field-2 Field-3 Field-4
      ..1 ....... xx........xx....xxyyxx
      ..-...........................xxyyxx
      177..........................xxyyxx
      ..1.......................... zzxxyy
      ..-...........................zzxxyy
      177..........................zzxxyy
      ......and so on

      sorry for the confusion and not explaining clearly. Does this help.
      Thanks,

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I think you will need to roll you own on this issue using the DMax() function.

  9. #9
    KramerJ is offline Novice
    Windows XP Access 2003
    Join Date
    Mar 2009
    Location
    Las Vegas, NV
    Posts
    15
    Thanks RG for you replies.

  10. #10
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Post back here it you are still having difficulties.

  11. #11
    KramerJ is offline Novice
    Windows XP Access 2003
    Join Date
    Mar 2009
    Location
    Las Vegas, NV
    Posts
    15
    Unfortunetly yes...I even posted on the MS Office Forum, EXCEL but haven't received any replies. I"'ve been just digging through manuals and just not getting any responses from other forums. You would think this would not be such an envolved issue: creating sequential number for a number of rows conditioned on a value in another cell and continue the process for x number of rows.

  12. #12
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    It is not difficult. A DMax() with a WhereClause is all it takes.

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

Similar Threads

  1. need query to assign sales leads to reps??
    By RickM in forum Queries
    Replies: 0
    Last Post: 03-12-2009, 02:44 PM
  2. Replies: 3
    Last Post: 02-20-2009, 02:28 PM
  3. Replies: 1
    Last Post: 02-05-2009, 04:53 PM
  4. Replies: 1
    Last Post: 01-31-2009, 10:43 AM
  5. create sequential id
    By proudestmnky1 in forum Programming
    Replies: 0
    Last Post: 12-16-2008, 12:10 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