Results 1 to 3 of 3
  1. #1
    celito is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    10

    Displaying query results in form

    I built a query called qryStudCount, based on two tables tbleStudents and tbleSections. Students are assigned to Sections. The queryStudCount shows how many students are enrolled in each Section.



    For example, if there are two sections, Alpha and Bravo with 4 and 7 students, respectively, the query table shows these counts.

    How can I display these numbers for a specific section in a field in a form? I used this expression in the control source for a field called studCount and can't get the correct count to display for either Alpha and Bravo

    =DLookUp("CountOfstudentNo","StudCount""[????]")

    Is the problem in the parameter field and how this should be written? Without the parameter, the expression returns a number, but not specific for the section.

    By the way, in the form is another field for sectionName, which is also a field in the query. Do I need to establish a relationship between these fields in the form and query? How?

    Many thanks for any help I can get.

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,849
    What exactly are the fields in each table?
    I think you need a relationship between the tables.

    For example:
    If you had 10 students and 3 sections, how would you know which student is in which section? What relates Student to Section.

  3. #3
    celito is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    10
    In the Students Table the fields are: student number and student name. In the Sections Table, the fields are section number, section name. I have a third table (Section Assignment) where I assign the students to a section. The fields in the Section Assignment table are section number, section name (from the Sections Table), student number and student name (from the Students Table). The query returns the number of students enrolled in each section. I wanted a field in the Section Assignment table that would return the value of the query when I click on section from the drop down list so that I would know the running total of students in that section. The query is working. I just want to copy that value in a field in the form.

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

Similar Threads

  1. Replies: 6
    Last Post: 05-14-2012, 07:24 AM
  2. Replies: 3
    Last Post: 03-18-2011, 08:15 AM
  3. Replies: 9
    Last Post: 12-13-2010, 09:25 PM
  4. Displaying query results within a form
    By Remster in forum Forms
    Replies: 5
    Last Post: 10-05-2010, 09:56 PM
  5. Replies: 0
    Last Post: 03-31-2010, 07:52 AM

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