Results 1 to 7 of 7
  1. #1
    kmccallsdsu is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2011
    Posts
    4

    (Noob) Need help with a query please

    I have a Classes table with the Class ID as the primary key.



    I have a Homework table with Class ID as the foreign key as well as an attribute titled Due Date.

    I want to implement a field in Classes called Next Assignment Due.

    I need a query to find the next closest due date for that particular Class ID.

  2. #2
    kmccallsdsu is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2011
    Posts
    4
    Did I do something wrong? 50 views no replies...Just to clarify:

    I am attempting to make a query that automatically fills out a field called [Next Assignment Due] in a table called [Classes]. In order to do this the query needs to go through a field called [Due Date] in a table called [Homework] and find the next closest date. The query also needs to make sure that the [Class ID] for that homework matches the [Class ID] for that class to make sure it is not finding the next assignment due for another class. Please and Thank you to anyone who helps.

  3. #3
    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,848
    Please show us what you have tried.

    Your second post indicates you have your logic sorted out, so what exactly is the issue?

    Don't store calculated fields.

  4. #4
    kmccallsdsu is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2011
    Posts
    4
    Thanks for responding Orange I appreciate it. The point of this database is to keep track of my homework (and hopefully get me some Extra Credit). I input homework into a homework table. These are the fields:

    Assignment ID-" An Autonumber for primary key"
    Class ID-"Shows which class homework belongs to"
    Name-"The name of the assignment"
    Grade-"My grade for the homework in a number, not required"
    Points Possible-"Maximum points in a number"
    Due Date-"Date assignment is due"
    Graded-"Yes/No field marking whether assignment is completed"

    Example:
    1
    ECON102
    Chapter 9 Homework
    0
    50
    3/16/2011
    Not Graded

    Obviously just one table of all my homeworks is messy so I made a table called Classes. These are the fields:

    Class ID-"Unique to each class this is also used as relationship with homework"
    Title-"Name of the class"
    Days-"text field just showing what days class is"
    Time-"text field just showing what time of day class is"
    Next Assignment due-"Here is the field I am working on. I want this field to show the title of the next homework due for this class."

    Example:
    ECON102
    Microeconomics
    Tuesday and Thursday
    9:30am-10:45am
    Chapter 9 Homework

    So far, I created the field called Next Assignment Due in the Classes table using Lookup & Relationship. I selected a query I made called Next Homework Due Query. The Query in design view looks like this:

    Field: Due Date
    Table:Homework
    Sort:------
    Show:Yes
    Criteria:>Date()
    or:------

    Field:Name
    Table:Homework
    Sort:------
    Show:Yes
    Criteria:------
    or:------

    What this does is shows the Due Date for every homework after today. To only return the next closest Due Date I made sure the values were Ascending and I changed the Top Values in properties to 1 so only one result is returned. So the query returns the Due Date and Name for the next closest Due Date. I don' think this works how I want it to though. Homework is not entered in according to ascending due date so I am pretty sure the query is just returning the first due date it finds that is greater than todays. I believe this part needs to be written by finding the smallest value of {todays date minus the due date} and returning that assignment. Another problem is the query is not making sure that the next closest Due Date is for the correct Class ID. Without this every class will show the same assignment, the one with the closest Due Date. I am not sure how to make this work and I feel like I am doing it all wrong haha.

    A couple added notes:
    ---I don't care if the query only returns the due date for the next homework or just the name for the homework I can always create another field once i figure out how to write this query.
    ---At the moment when I go to fill in the fields under Next Assignment Due in the Classes table dropdowns appear for each class showing the result of the query. If possible I don't want to have to enter the value I want the query to automatically update the table. I think this is possible by changing the query type to update but I am not sure how to make this work either.

  5. #5
    kmccallsdsu is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2011
    Posts
    4

    Seriously?

    This forum sucks.

  6. #6
    Buakaw is offline Absolute novice
    Windows XP Access 2007
    Join Date
    Jan 2011
    Posts
    112
    Here's one newbie to another:

    In query design view, add a new column called [TimeToMug]:[HomeworkTable].[AssignmentDueDate] - Now()

    Then sort it as Ascending, and sort your entire query according to this column.

    You can also elect not to display this query by unchecking the tick in Design view.

    See if this does what you want.

  7. #7
    Buakaw is offline Absolute novice
    Windows XP Access 2007
    Join Date
    Jan 2011
    Posts
    112
    In future, taking some screenshots of your tables and your Query design view screen might help in getting more responses.

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

Similar Threads

  1. Please help noob question.
    By Deano in forum Forms
    Replies: 3
    Last Post: 01-24-2011, 12:33 PM
  2. Replies: 9
    Last Post: 07-21-2010, 06:34 AM
  3. Some questions from a noob
    By Seamus in forum Database Design
    Replies: 3
    Last Post: 04-30-2010, 05:47 AM
  4. Replies: 2
    Last Post: 05-27-2009, 08:47 PM
  5. Noob Query Help Needed
    By fenster89411 in forum Queries
    Replies: 0
    Last Post: 01-11-2009, 09:47 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