Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Jan 2004
    Posts
    196
    Thanks
    1
    Thanked 0 Times in 0 Posts

    subtracting fields (2003)

    I am trying to subtract a field from the current record with the same field in the previous record. Can anyone help me, please.
    Thanks,
    Jackal

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: subtracting fields (2003)

    In general, you need a custom VBA function to retrieve values from the previous record - see MSKB article ACC2000: Referring to a Field in the Previous Record or Next Record. This article contains a link to download a sample queries database that contains the code and a working example.

    In special situations, you can do without a custom function - see ACC: How to Compare a Field to a Field in a Prior Record.

    (Although these MSKB articles are for older versions of Access, the techniques described in them are general.)

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: subtracting fields (2003)

    Your problem is really going to be determining which is the "previous" record, since Access records don't have any fixed order.
    Charlotte

Posting Permissions

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