Wondering if someone could help me with a subquery (i only learned they existed today) Is it possible to have multiple criteria in them? For instance i want a TU_CODE where they're in a certain faculty, tu_only is false AND where the number of students they already have (gotten by me trying to do a subquery) is not over the chamber size AND another subquery where none of that tutors entries in tblPreference are for a certain course?? Here's what i have so far, and all it gives me is a syntax error
strsql2 = "Select tblTutor.TU_CODE " _
& "From tblTutor " _
& "Where tblTutor.[TU_FAC_NO] = " & fac & " AND tblTutor.[TU_ONLY] = false AND (Select tblStudents.STU_TU_CODE from tblStudents where tblStudents.TU_CODE = tblTutor.TU_CODE AND ([tblTutor.TU_CHAMBER_SIZE] > (Count([tblStudents].STU_TU_CODE)))) " _
& "AND WHERE NOT EXISTS (Select tblPreference.TU_CODE from tblPreference where tblPreference.TU_CODE = tblTutor.TU_CODE AND tblPreference.[TU_COURSE] = '" & course & "')"
Any help would be really gratefully appreciated!
strsql2 = "Select tblTutor.TU_CODE " _
& "From tblTutor " _
& "Where tblTutor.[TU_FAC_NO] = " & fac & " AND tblTutor.[TU_ONLY] = false AND (Select tblStudents.STU_TU_CODE from tblStudents where tblStudents.TU_CODE = tblTutor.TU_CODE AND ([tblTutor.TU_CHAMBER_SIZE] > (Count([tblStudents].STU_TU_CODE)))) " _
& "AND WHERE NOT EXISTS (Select tblPreference.TU_CODE from tblPreference where tblPreference.TU_CODE = tblTutor.TU_CODE AND tblPreference.[TU_COURSE] = '" & course & "')"
Any help would be really gratefully appreciated!