www.webdeveloper.com
Results 1 to 4 of 4

Thread: How can I do this?? A loop?

  1. #1
    Join Date
    Nov 2006
    Posts
    10

    How can I do this?? A loop?

    This seems simple but I can't figure it out.

    I'm pulling back a record set that shows all budgets entered for a company - the main values are EditedBy and Amount. So it might show:

    EditedBy Amount
    ------------------
    jsmith 1000.00
    kjones 1500.00

    I'd like to somehow dynamically pickup the amount the budget has changed with each edit. So after the "Amount" column, I'd like to have a "change amount" column. Using my example, the Change Amount column would show "$500.00" next to the 1500.00 since the budget increased from 1000.00 to 1500.00...

    EditedBy Amount ChangeAmt
    -----------------------------
    jsmith 1000.00 --
    kjones 1500.00 $500.00

  2. #2
    Join Date
    Oct 2006
    Posts
    1,297
    Code:
    previous_amount = rs.Fields("Amount").Value
    Do While Not rs.EOF
        Response.Write "<tr><td>" & _
            rs.Fields("EditedBy").Value & "</td><td>" & _
            rs.Fields("Amount").Value & "</td><td>" & _
            (rs.Fields("Amount").Value - previous_amount) & "</td></tr>" & vbCrLf
        previous_amount = rs.Fields("Amount").Value
        rs.MoveNext
    Loop
    Last edited by so_is_this; 11-27-2006 at 01:19 PM.

  3. #3
    Join Date
    Nov 2006
    Posts
    10
    Thank you!!! Perfect. I knew it was easy...for someone.

  4. #4
    Join Date
    Oct 2006
    Posts
    1,297
    Salud!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles