none
Need Help with Web App Calculations RRS feed

  • Question

  • Hello,

    I am using the "Classes" template for creating an Access Web App in Access 2016. I am tracking student data and enrollments in classes. I have the 5 standard tables set up for this template: Classes, Departments, Teachers, Students, Enrollments (hidden table). I am having trouble doing some calculations with this template.

    I need to make these calculations:

    1. Total students enrolled in all classes

    2. Total students enrolled in all classes for a particular semester

    3. Total male students enrolled in all classes for a particular semester

    4. Total female students enrolled in all classes for a particular semester

    5. Total male students across all classes who hold a leadership position in a given semester

    6. Total female students across all classes who hold a leadership position in a given semester

    Can anyone help me set his up?

    Thanks so much!

    Friday, January 6, 2017 10:14 PM

All replies

  • The most likely reason you are having problems is because your tables are set up incorrectly -- (I'm getting this from reading your mind -- part of a programmer's duties -- gotta read the boss's mind).  To calculate enrollment you would have a column that takes a class ID, a student ID.  

    Select count(classID) from tblEnrollment
    Group By ClassID

    This gives you the count of students per class.  Very basic  1 student per classID.


    Rich P

    Saturday, January 7, 2017 1:21 AM
  • Is this for a school assignment?

    -Tom. Microsoft Access MVP

    Saturday, January 7, 2017 1:59 AM
  • Hi caballar,

    you need to use Count function to get Total Records.

    Example

    SELECT Count(*) AS TotalOrders FROM Orders; 

    Reference:

    Count Function

    to calculate total male and female students you need to use where clause in your query.

    example

    SELECT Count(std_name) FROM TBL_Student where gender='male'; 

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, January 9, 2017 5:02 AM
    Moderator