Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2010
    Location
    UK
    Posts
    160

    Unanswered: Help with a design idea + and - buttons

    Hi there,

    I'm after a bit of input from the professionals!!!

    I have a list of parts in a table.
    I have a field called LineNumber

    When I add a part to the table I give it a number 1, 2 , 3 etc.

    I group on this number in a report so i have control of the order in which the parts are displayed. Part 1 at the top of the page, part 2 next etc.

    I manually change the LineNumber in the form to display the parts in a certain order.

    I would like to automate this process.

    I'm thinking next to each part I have a + or - button. If I click on + the number is incremented and the part moves down the list. I'll end up with 2 parts sharing the same number so I'll have to decrement the other part. (does that makes sense?)

    Line 001 Part A
    Line 002 Part B
    Line 003 Part C

    So in the above example if I click the + button next to Part B it should re-arrange my parts as follows

    Line 001 Part A
    Line 002 Part C
    Line 003 Part B


    If anyone could offer any advice on whether this is possible and how should I approach it I would be very grateful
    thanks
    marcus

  2. #2
    Join Date
    Apr 2004
    Location
    metro Detroit
    Posts
    634
    Grab the line number that you're changing the current part to (b) and the original line number (a). Update the line numbers of the other parts based on these two numbers.

    x= original line number
    y=new line number

    if a>b then if x is >=a and <b then y=x+1

    if a<b then if x is >a and <=b then y=x-1

  3. #3
    Join Date
    Sep 2010
    Location
    UK
    Posts
    160
    thanks rogue that sounds like a plan

    I'll post what I come up with.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •