RE: What causes the "#Name?" error in text box?

From: MDW (MDW_at_discussions.microsoft.com)
Date: 09/29/04


Date: Wed, 29 Sep 2004 08:55:08 -0700

What's the name of your text box? If it's named "groups", "groupWeight", or
any of the columns/tables listed in your DLookup, that could be the problem.

I used to have that #Name? error all the time, and it came from when I used
the report wizards, which name text boxes the same as the fields they're
bound to.

That'd be the first thing I'd check.

"Richard Hollenbeck" wrote:

> Once I get this working I'll need to use this code several times in one form
> or report.
>
> The following code typed into a text box returns the "#Name?" error:
>
> =Nz(DLookup("groupWeight","groups","groups.courseCode= '"
> & [courseCode] & "'"),1) /
> Nz(DSum("groupWeight","groups","groups.courseCode= '"
> & [courseCode] & "'"),1) *
> Nz(DLookup("score","studentScores","activities.activityID= "
> & [studentScores].[activityID] & "AND [studentScores].[studentID]= "
> & [students].[studentID]),1) *
> Nz(DLookup("activityWeight","activities","activities.groupID= "
> & [groups].[groupID]),1) /
> Nz(DSum("activityWeight","activities","activities.groupID= "
> & [groups].[groupID]),1)
>
> Could the problem be that I'm trying to have two criteria in the score
> lookup? Maybe I need to reference the query instead of the actual tables
> the query is based on? Maybe just list the query's fields instead of even
> using a lookup at all?
>
> I'm wondering if I have an "order of operations" problem here. I suppose I
> could add parentheses to order the divisions to calculate first, but I don't
> believe that would cause the "#Name?" problem. I think it would simply give
> me the wrong answer.
>
> I made the Nz() function default to 1 in an effort to avoid potential divide
> by zero errors.
>
> The form's record source is a query that provides all these tables and
> fields.
> courseCode is a text value, while groupID, activityID and studentID are all
> long integers.
>
> This is approximately the code I will need to get each student's semester
> current average--I think. Once I get this working correctly, I'll need to
> add a count to get all students with a semester average of >=92 for the A
> box, >=82 for the B box, >=72 for the C box, etc. However, I'll never get
> to do that if I don't even get this working.
>
> In some kind of pseudocode, the formula should work something like this:
> count of: ((this activity's weight / sum of all activities' weights in this
> group) * (this group's weight / sum of all groups' weights in this course) *
> (this student's score in this activity)) where result >=92, etc.
>
> Thanks.
> Rich Hollenbeck
>
>
>



Relevant Pages

  • Re: Basic Question for Lookups.
    ... However, especially in the early phases of setting up your Tables, you will probably need at times to look at their contents, and if so, you probably will want to define lookup properties on the foreign keys. ... The Query that I would suggest is similar to what the Lookup Wizard defines, except that I give mine a name, and I limit it to 2 fields instead of several. ... 1801550689 Michael Zachary Jackson ... I'm properly storing Prospect ID pk then FirstName then Middle then Lastname fields.etc. ...
    (microsoft.public.access.tablesdbdesign)
  • Re: Tip: Table design and query for bracketed lookup
    ... WHERE [Enter Bracket:] ... No rows would be returned by the query! ... If the "lookup" value is in a column of your query called Lookup, ... FROM RateTable RT1 ...
    (microsoft.public.access.queries)
  • Re: WHERE statement
    ... with basically all the info going to one table, except now the suppliers, ... "Jeff Boyce" wrote: ... and you can still use a combobox to list the lookup values. ... I know I get the ID field if I query against a 'lookup' ...
    (microsoft.public.access.gettingstarted)
  • Re: Understanding what makes Access tick
    ... > Query, but which is the subject of a table's lookup relationship. ... allow any "main" record..and "maybe" a child record. ... want here is a simply list of tasknumbers. ...
    (microsoft.public.access.gettingstarted)
  • Re: WHERE statement
    ... "Jeff Boyce" wrote: ... You can change the table's field from a lookup type to a (?whatever the ... I know I get the ID field if I query against a 'lookup' value. ... NOT USE Lookup data type fields, for just that reasons. ...
    (microsoft.public.access.gettingstarted)