Results 1 to 5 of 5
  1. #1
    paulh_36 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2014
    Posts
    5

    Access 2010 Form, Receiving #Name? Error when trying to retreive data from a query


    Hello, This is my first post. I've been trying to resolve a #Name? error in a calculated field on form I have. The form displays registration information for workshops that my organization provides. For a specific person I have a sub-form that displays all the workshops that a the person has taken. In that sub-form I have a calculated field that should return the total number of registrants for any particular workshop listed that this person has taken. The calculated field references a query that returns only one record, the total number of registration records for that specific "EventID" which it in turns gets from the sub-form. If I bring up the form, or the sub-form by it's self then run the query the query results are fine. The problem is I can't get the query results to display in the calculated field (so the #Name? error). There appear to be no naming conflicts as others have suggested. The underlying expression in the calculated field is "=[qryEventsCount].[CountOfRegistrationID]" (query.fieldname). I was wondering if I had some sort of circular logic going on. Thank so very much for any insights ....

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    On the subform, is this entire form connected to the query: qryEventsCount?

    If not, then you must do =Dlookup("[CountOfRegistrationID]","qryEventsCount")
    to look at a query different from the subform.

    You cant put query.field as a calculated field. The function Dlookup does this.

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    As ranman noted, cannot refer to tables and queries directly in textbox expression - table or query must be part of the form's RecordSource or use a domain aggregate expression in textbox to pull data from table or query.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    paulh_36 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2014
    Posts
    5
    Thank you very much ranman & Moderator I have been looking at Dlookup but with no success so far, but I need to explore further as I have never used it before with Access. I will look into the domain aggregate expression.. don't know too much about it though.

  5. #5
    paulh_36 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2014
    Posts
    5
    Ranman & Moderator, Thank you very much for your assistance. After some experimentation I did get Dlookup to work like a charm. Thank you again !!

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

Similar Threads

  1. Receiving Error Message when running Query second time
    By alansidman in forum Programming
    Replies: 3
    Last Post: 03-20-2014, 08:55 AM
  2. Replies: 6
    Last Post: 06-27-2013, 12:38 PM
  3. Replies: 11
    Last Post: 08-27-2012, 11:26 AM
  4. Replies: 3
    Last Post: 07-20-2012, 11:55 PM
  5. Replies: 1
    Last Post: 12-02-2010, 03:04 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