Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2013
    Posts
    6

    Calculations in a query

    I want to perform a calculation that returns a value that is the difference between current month and previous month.

    I have a data base for trucks, mileage, hours etc.

    So the calculation will be on the Mileage feild. I know how to write and expression to perform a calculation between one field and another, but, is it possible to get calculate the differnce between values using the same feild. I.E

    Month January February


    Mileage 109000 101000

    Many thanks in advance.

  2. #2
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,536
    Here is a database that I built for a friend that tracks service and gas usage. Look at the queries to see how this is accomplished.
    Attached Files Attached Files

  3. #3
    ph_jawad is offline Novice
    Windows XP Access 2010 64bit
    Join Date
    Feb 2013
    Posts
    4
    use "datediff" function in date/time builtin expression builder functions

  4. #4
    Join Date
    Jan 2013
    Posts
    6
    Alansidman. Your database is quite cool. I've looked at your queries. It looks like you are performing calculations comparing one field to another. I want a calculation comparing a field against itself. I think the ph_jawad may be onto something with the datediff function, but, how do I build an expression like that in querie? How do I activate the expression builder and what would such an expresison look like?? I am a novice developer.

  5. #5
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,536
    Here is a an explanation on DateDiff with examples

    http://www.techonthenet.com/access/f...e/datediff.php

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Calculations in a query
    By bishop0071 in forum Queries
    Replies: 1
    Last Post: 01-27-2013, 03:54 PM
  2. Conditional calculations in a query?
    By Datech in forum Queries
    Replies: 3
    Last Post: 06-17-2012, 09:39 PM
  3. Parameter Query Calculations
    By mrk7891 in forum Queries
    Replies: 2
    Last Post: 11-04-2011, 04:33 PM
  4. Calculations in Query
    By jdhaldane in forum Queries
    Replies: 5
    Last Post: 12-10-2010, 05:57 AM
  5. MSACCESS Query with calculations?
    By Masterfinn in forum Queries
    Replies: 10
    Last Post: 02-24-2010, 10:51 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums