Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2014

    Unanswered: Attempting to have single query result display in Text box on Form

    I have the need to display the return of my "Sum Query" to display in a text box.

    I need the attached below value (40500) in the "SumofQuery" attachment, which updates every 5 minutes to display on the "StatusBoard" attachment text box.

    I have been searching for a good 10 hours on how to do this and still cannot find it.

    I know I am over thinking the solution and cannot figure it out.

    Any help is greatly appreciated.

    Thanks in advance.

  2. #2
    Join Date
    Mar 2009
    Provided Answers: 14
    To extract the value(s) returned by a query, you use a Recordset:
    Const c_QryName As String = "SumofQuery"
    Dim rst As DAO.Recordset
    Set rst = CurrentDb.OpenRecordset(c_QryName, dbOpenSnapshot)
    If rst.EOF = False Then Me.StatusBoard.Value = rst.Fields(0).Value
    Set rst = Nothing
    If this is to be updated at regular time interval, you can use the Form_Timer event handler to execute the procedure.
    Have a nice day!

  3. #3
    Join Date
    Jun 2005
    Richmond, Virginia USA
    Provided Answers: 19
    I'd use DSum() in the Control Source Property of the Unbound Control, but that's just a matter of personal taste:

    = DSum("[FieldToBeSummed]", "Table or Query Name")

    If there is a restriction as to which records are to be summed, add the third (Criteria) parameter to the DSum().

    Linq ;0)>
    Last edited by Missinglinq; 07-05-14 at 17:57.
    Hope this helps!

    The problem with making anything that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Posting Permissions

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