Results 1 to 3 of 3
  1. #1
    Gary_R is offline Novice
    Windows 10 Access 2016
    Join Date
    Apr 2020
    Posts
    1

    DAvg is not working in a Text Box Control Control Source linked to an Existing Query

    Hi all, I am “re-new” to Access. The last time that I worked with ACCESS was in 1999 or so. I am hacking my way through to create a nice pricing tool for our company. So any advice or directions that you can provide is greatly appreciated. Thank you in advance!!!



    I guess my questions; Is it proper to use DAvg to group records and average multiple fields within that group? If yes, can I use DAvg on an existing Query?

    Let me explain:
    I have two text boxes on a form. One text box is a DLookup that uses a Table and works perfect. I uploaded a screenshot and pasted the Control Source statement below. The second text box is a DAvg that uses an existing Query [Sales_Price_Query] but results is #Name?. Notice below and attached that I followed the same format that I used for a DLookup statement.

    I am NOT familiar with the DAvg. I am trying to use the DAvg to group on the SKU number and create an Average. Notice in the screenshot [Sales_Price_Query] results attached, some SKUs have multiple records. The reason is that we receive multiple shipments (Lots) of the same SKU.

    DAvg NOT WORKING: DAvg statement in a Text Box named “Avg InWhse” and the result is #Name?
    =DAvg("[InWhse]","[Sales_Price_Query]","[SKU]=" & [Forms]![Pricing_Decision_Form]![SKU])

    DLookup Working Perfect: DLookup statement in a Text Box named Description. Works correctly.
    =DLookUp("[Description]","[Product_Info]","[SKU]=" & Forms![Pricing_Decision_Form]!SKU)

    Click image for larger version. 

Name:	PricingDecisionForm_Screenshot.jpg 
Views:	9 
Size:	169.6 KB 
ID:	41632Click image for larger version. 

Name:	SalesPriceQuery_Screenshot.png 
Views:	9 
Size:	78.8 KB 
ID:	41633

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    make a query that does the AVG using the sku on the form in the query, you can see the correct Avg in the query.
    then make the text box show it via: DLOOKUP()

  3. #3
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,928
    doesn't look like you are using the same criteria in the dlookup that is not working

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

Similar Threads

  1. Text Box Control Source
    By GraeagleBill in forum Forms
    Replies: 11
    Last Post: 04-08-2016, 09:54 AM
  2. Replies: 4
    Last Post: 02-18-2016, 12:06 PM
  3. Text Box Control Source
    By ajs112 in forum Forms
    Replies: 1
    Last Post: 09-15-2014, 10:39 AM
  4. Text Box Control Source Issue
    By timbit6002 in forum Forms
    Replies: 8
    Last Post: 03-01-2012, 02:03 PM
  5. IIF statement in control source of text box
    By LilMissAttack in forum Reports
    Replies: 11
    Last Post: 08-18-2011, 10:02 PM

Tags for this Thread

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