Results 1 to 5 of 5
  1. #1
    Underworld is offline Novice
    Windows XP Access 2000
    Join Date
    Feb 2010
    Posts
    2

    Post Increasing values

    I have a field with number values

    id_field contains numbers like 1,2,3,4.....(some of them are repeated)

    In a form the user introduces for example 2, then all the values >= increase by 1, how I do that?

    (cod-id)
    1-1
    2-2
    3-1
    4-1
    5-2
    6-3
    7-4
    8-5

    the user introduces 4 then...

    1-1
    2-2
    3-1
    4-1
    5-2
    6-3
    7-5 (change id +1)


    8-6 (change id +1)
    9-4 (new)

    or just tell me, this is possible in access or not??

  2. #2
    NassauBob's Avatar
    NassauBob is offline Not THAT Green
    Windows XP Access 2003
    Join Date
    Feb 2010
    Location
    Augusta, GA
    Posts
    61
    So I understand that the first number in the 1-1, 2-2, etc. is the line number, and not part of the data? And you would like to ++ every entry in the table which has a value greater than or equal to each newly input value? How is the new value being inserted - in a form?

    I think this can be done, probably in a module which fires before the data is committed to the table. The module should run an update query which will only act on records where the aforementioned condition is met, and should change those values in the table. The reason I would have the query run before the data is committed is so that you will not include the new record in the ones being changed.

    Make sense?

  3. #3
    NTC is offline VIP
    Windows Vista Access 2007
    Join Date
    Nov 2009
    Posts
    2,392
    yes it is possible in Access. there is no question of that. it is possible in excel. it is possible in any db.

    you have a messed up basis because 1-1 is not a number. It can only be text. But you can segregate all characters to the right of the dash into a separate column - and then manipulate the value - and then reassemble it back together again.....

  4. #4
    NassauBob's Avatar
    NassauBob is offline Not THAT Green
    Windows Vista Access 2007
    Join Date
    Feb 2010
    Location
    Augusta, GA
    Posts
    61
    My thinking was that he was using a crude form of line numbering, presumably for our better understanding of the data structure. If you look in the first paragraph, he states that the field contains numbers like 1,2,3,4...

  5. #5
    Underworld is offline Novice
    Windows XP Access 2000
    Join Date
    Feb 2010
    Posts
    2
    yes, what I want to increase is a number.

    When I said 1-1 the first number is autonumeric key, the other is id( the value I want to increase).

    Want I have is something like an index for books like 1.2.3.4 (each value has its table), so for example 1. is life&nature 2.animals 3.mamifers and 4.lion

    So I have in my table
    (id_field)
    1
    2
    3
    1
    2
    3
    4

    so, if the user wants to introduce a new value like 3 in group of animals, mamifers will be 4. and so on..

    like...

    1
    2
    3 (don't increase because it doesn't belong to the chapter "animals")
    1
    2
    4(+1)
    5(+1)
    3


    Yes, I think the solution is an UPDATE

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

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