Moving Record Position

Results 1 to 2 of 2

Thread: Moving Record Position

  1. #1
    Join Date
    Dec 1969

    Default Moving Record Position

    I want to able to manage a one-coloum list of records in a table by allowing me to move each row to different position in an Access database <BR><BR>Example <BR><BR>Table in database: <BR>ID Names Order <BR>1 Tim 1 <BR>2 John 2 <BR>3 Josh 3 <BR>4 Fred 4 <BR>5 smith 5 <BR><BR>Say, I want to make a change in my admin page, move Fred (4) to John (2) and it then prints out like below (look at the IDs and order). <BR><BR>An html printed out: <BR>ID Names Order <BR>1 Tim 1 <BR>4 Fred 2 <BR>3 Josh 3 <BR>2 John 4 <BR>5 smith 5 <BR><BR>In the admin page, to make the change there would be drop down lists etc but no input fields to enter value text or number. <BR><BR>How could write this <BR><BR>Thanks for any help <BR><BR>James <BR>

  2. #2 Guest

    Default RE: Moving Record Position

    You would have a droplist showing the current positions (Order col) and when submit the asp page would increase the order col of all those equal or greater than the order number and then set the target one to the new order number.<BR><BR>&#060;% <BR>ord = request.form("Order") &#039; Get the new number<BR>Conn.execute "Update tbl set [Order] = -1 where Name = &#039;Fred&#039;" &#039; Set fred&#039;s order to something outside the range<BR>Conn.execute "Update tbl set [Order] = [Order] + 1 where [Order] &#062;= " & Ord &#039; Increment those at or above the order number<BR>Conn.execute "Update tbl set [Order] = " & ord & " where Name = &#039;Fred&#039;" &#039; Set fred&#039;s order to the new order number<BR>

Posting Permissions

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