Results 1 to 3 of 3

Thread: Query formula?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Location
    Fremont Ohio 43420
    Posts
    253

    Question

    Hi

    I know this maybe simple for some, but I don't work much with access 97. I need a formula to sum up some fields. Something like this Total = Repairtime + setuptime + pmtime. Can anyone help?

    Thanks aja

  2. #2
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,539
    i dont know how to sum all the fields up togather at once
    dont know if it could be done either
    how i would do it is
    make 3 sql statments
    and do them as follow

    dim Total as double
    SQL = "SELECT SUM(repairtime)as Total FROM myTable"

    then you need to capture that and return that sum first

    RS.Open SQL, conn
    Total = RS("total")
    RS.close

    then do it again

    SQL = "SELECT SUM(setuptime)as Total FROM myTable"

    then you need to capture that and return that sum first

    RS.Open SQL, conn
    Total = Total + RS("total")
    RS.close

    and finally do it for pmtime

    SQL = "SELECT SUM(pmtime)as Total FROM myTable"

    then you need to capture that and return that sum first

    RS.Open SQL, conn
    Total = Total + RS("total")
    msgbox "Total for all " & Total

    RS.close


    OR

    you this MIGHT work
    SQL ="SELECT SUM(repairtime, pmtime, setuptime)

    i doubt it will thou
    but give it a shot

    [Edited by kovan on 10-30-2000 at 12:27 PM]

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Location
    Fremont Ohio 43420
    Posts
    253
    Thanks kovan,

    I figured out how to total up the fields in my database. Thanks again for the suggestion!
    aja

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