Results 1 to 4 of 4
  1. #1
    Jamescdawson is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2012
    Location
    South Wales, UK
    Posts
    98

    Question Displaying result from a query in a form results in "#Name? being returned

    Hello All,



    I've built a Query that is intended to sum the payments made by individual clients. It looks at all payments made to each account and returns the total for that client. The query works fine and it sums all the payments made by that customer against that customer's name.

    There is a 1 to Many relationship between the Client Table and the Payments table.

    I then included a Text box field in the "Client Record form" where I want to display this calculated sum. (This is so that the DB user can see what's been paid to account so far for each customer simply by looking at that client's Record. I intend to have a second box showing "Amount Outstanding" which will be a calculation.

    In the control source field for the text box, I put

    "=[QryTotalPaymentsReceived].[SumOfPaymentReceived]" This is the field where the total payments is returned in the query

    Dispite the query having references to the client & clientID, the sum figure is not displayed. Instead, I get "#Name?"

    Can anyone tell me what am I missing? or where I'm going wrong

    Jimbo

  2. #2
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    What is the recordsource for the form? If it is not QryTotalPaymentsReceived then that is the problem. If you want to retrieve the value of SumOfPaymentReceived from the query, you probably sould be using DLookup, something like this:

    =Dlookup("SumOfPaymentReceived","QryTotalPaymentsReceived","Criteria...")

    Where "Criteria" identifies the current customer (that is only a guess, based on your description), and presumably the current customer number is in a form field.

  3. #3
    Jamescdawson is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2012
    Location
    South Wales, UK
    Posts
    98
    Hi John G, Thanks for the (very) quick response.

    Schoolboy error... The record source for the form is the Client & Customer Table.

    I tried DLookup like this....

    =DLookUp("SumOfPaymentReceived","QryTotalPaymentsR eceived","Surname")

    and

    =DLookUp("SumOfPaymentReceived","QryTotalPaymentsR eceived","CustomerID")

    But it returns the first record in the query irrespective of which client record I go to... Do I need to give more detail in the criteria ?

  4. #4
    Jamescdawson is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2012
    Location
    South Wales, UK
    Posts
    98
    John G

    GOT IT

    =DLookUp("SumOfPaymentReceived","QryTotalPaymentsR eceived","[CustomerID] = Form![CustomerID]")

    Thanks for your help ! Much appreciated

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

Similar Threads

  1. Replies: 1
    Last Post: 01-06-2013, 01:47 PM
  2. Replies: 1
    Last Post: 10-01-2012, 12:31 PM
  3. Replies: 10
    Last Post: 08-01-2012, 11:32 AM
  4. Displaying query results in form
    By celito in forum Access
    Replies: 2
    Last Post: 08-27-2011, 09:14 AM
  5. Displaying query results within a form
    By Remster in forum Forms
    Replies: 5
    Last Post: 10-05-2010, 09:56 PM

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