Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Apr 2003
    Location
    Calgary, Alberta
    Posts
    327
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Textbox = Sum of Query (Access 2000)

    Another question, I want a textbox which equals the value of a query. How can I get that query to fire so the value in the textbox gets updated. Using DoCmd.openquery opens the actually query as well as gives the results. This query is also a union query, so I need both Sums to add together.

    Thanks

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

    Re: Textbox = Sum of Query (Access 2000)

    You can't really speak about "the value of a query". A query returns records (if it is not an action query), and the records have fields.

    If the query is the record source of the form, you can set the control source of the text box to =Sum([MyField]) where MyField is the name of the field.

    If the query is not the record source of the form, you can use DSum: set the control source of the text box to =DSum("[MyField]","[MyQuery]") where MyField is the name of the field and MyQuery is the name of the query.

Posting Permissions

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