Results 1 to 3 of 3

Thread: [RESOLVED] ms access query/ form accumulate value

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2005
    Posts
    586

    Resolved [RESOLVED] ms access query/ form accumulate value

    I have an ms query with items and values. I'd like to create a form based on it with a third column holding the accumulated value. for example:

    item......price.......accum price
    1...........1.5..............1.5
    2...........2................3.5
    3...........1................4.5

  2. #2
    Hyperactive Member nagasrikanth's Avatar
    Join Date
    Nov 2004
    Location
    India,Hyderabad.
    Posts
    420

    Lightbulb Re: ms access query/ form accumulate value

    VB Code:
    1. Dim rst As Recordset
    2. Dim prevval As Double
    3. Set rst = CurrentDb.OpenRecordset("select * from table1")
    4. While Not rst.EOF
    5. rst.Edit
    6.     rst("accum") = prevval + rst("price")
    7. rst.Update
    8. prevval = rst("accum")
    9. rst.MoveNext
    10. Wend

    where table1 is ur table (not a query) containing the items and values..

    If ur problem got resolved,then please rate the post..
    The Difference between a Successful person and others is not a Lack of Knowledge,
    But rather a Lack of WILL

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2005
    Posts
    586

    Re: ms access query/ form accumulate value

    thanks a lot

Posting Permissions

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



Click Here to Expand Forum to Full Width