Microsoft Access Forums

Go Back   Microsoft Access Forums > Access Forums > Queries

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 01-28-2009, 08:46 AM
Novice
 
Join Date: Jan 2009
Location: Toronto, Ontario
Posts: 1
jenny_jumps is on a distinguished road
Default Querying Queries for Music School

Hey Guys,

I opened access for the first time last week and I've gotta say it's pretty amazing.

I'm trying to create a more sophisticated system for my little music school (as in, keeping records instead of losing them!). I've been doing ok but I've just been stumped by some angry sounding error messages!

Here is the problem:

I need a system to tell me how many lesson credits are remaining for each student.

I have two queries: a) lesson totals and b)attendance totals.

Here is a) Lesson Totals:
SELECT Invoice.StudentID, Invoice.InstructorID, Sum([PaymentAmount]/20) AS Credits
FROM Invoice
GROUP BY Invoice.StudentID, Invoice.InstructorID;

Here is b) Attendance Totals:
SELECT Attendance.StudentID, Attendance.InstructorID, Sum(Attendance.CreditsUsedToday) AS SumOfCreditsUsedToday
FROM Attendance
GROUP BY Attendance.StudentID, Attendance.InstructorID;

I've tried to amalgamate the two queries in a new query. The idea is something like:

SELECT [Attendance Totals].StudentID, Sum([Credits]-[sumofcreditsusedtoday]) AS Remainder
FROM [Attendance Totals], [Lesson Totals]
GROUP BY [Attendance Totals].StudentID;


Unfortunately the Remainder comes up with values that I can't interpret. If you see the attached pictures you'll see that the values in the Credits Column are small numbers but the results in the Remainder Column are related incorrectly.

Any ideas?
Attached Images
File Type: gif attendancetotalsquery.gif (40.4 KB, 4 views)
File Type: gif lessontotalsquery.gif (39.2 KB, 4 views)
File Type: gif remainderquery.gif (32.5 KB, 3 views)
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Combining Two Queries csolomon Queries 1 09-03-2009 11:33 AM
Crosstab Queries albst130 Queries 0 03-07-2007 06:32 AM
Queries the max from two rows mohsin74 Queries 0 12-14-2006 09:52 PM
VBA and stacked queries Pudy Queries 0 11-28-2006 12:58 PM
Time queries ddog171 Queries 2 06-04-2006 04:45 PM


All times are GMT -8. The time now is 02:59 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.