Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2004
    Posts
    11

    Unanswered: How do I update a table with a query (uses sum)

    I'm making a database for my cousins garage and have sort of come stuck. Basically I have a table that holds jobs and the sum query uses three of the tables fields; cost, paid and used. The query sums the value of cost where paid is true and used is false. After this an update query will be run to to change the value of used to true for each entry that has been summed (so that the same entry is not used twice). This all works fine at the moment the only problem is I can't do anything with the summed value. I want to place it in a table which will hold the balance. Also is it possible to run several queries from one form buttun?

  2. #2
    Join Date
    Aug 2004
    Location
    Steamboat Springs, CO
    Posts
    37
    I'm not quite catching your drift here? I getting that there is a table with a record for each order? Job? Something like that. You're changing a value with a query to mark when these orders have been processed (which should probably be done with VBA). You are trying to calculate a sum for each of the orders and storing that value in another table.

    There is no problem running 100 queries with one button, just a matter of writing the code.

    insert this code in the "On Click" event for your button:

    docmd.openquery "Nameofyourquerygoeshere"
    docmd.openquery "Nameofsecondquerygoeshere"

    and so on for more queries....

    I'm not quite getting the sum issue.

    You said "The query sums the value of cost where paid is true and used is false." So what is cost summing with in each record? It should be just a matter of creating a calculated field in an update query for the simplest solution.

    Jeremy Brooks
    PSIA-RM

Posting Permissions

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