C
celineusa
Hello!
Here is part of my database:
tblStudents: StudentID
tblStudentsAndMajors: StudentID, MajorID
tblMajors: MajorID
tblMajorsAndClasses: MajorID, ClassID
tblClasses: ClassID
tblStudentsAndClasses: StudentID, ClassID, QuarterTaken
In my form, when I remove a major from a student, I want it to delete
two things:
- in tblStudentsAndMajors: remove the record where StudentID (11 as a
test) and MajorID (2 as a test) match StudentID and MajorID from the
form
- in tblStudensAndClasses: remove the records where StudentID and
MajorID match StudentID and MajorID from the form, and where
QuarterTaken is false
DELETE [Students And Majors].*, [Students And Classes].*
FROM (Majors
INNER JOIN ((Classes
INNER JOIN [Classes And Majors]
ON Classes.ClassID = [Classes And Majors].ClassID)
INNER JOIN [Students And Classes]
ON Classes.ClassID = [Students And Classes].ClassID)
ON Majors.MajorID = [Classes And Majors].MajorID)
INNER JOIN [Students And Majors]
ON Majors.MajorID = [Students And Majors].MajorID
WHERE ((([Students And Classes].StudentID)=11)
AND (([Students And Classes].Taken)=False)
AND (([Students And Majors].StudentID)=11)
AND (([Students And Majors].MajorID)=2));
When I do that query, the datasheet view gives me the results I want
(all the line to delete), but if I run the query, I get "Cannot delete
from specified tables".
Does anyone has an idea?
Thanks,
Celine
Here is part of my database:
tblStudents: StudentID
tblStudentsAndMajors: StudentID, MajorID
tblMajors: MajorID
tblMajorsAndClasses: MajorID, ClassID
tblClasses: ClassID
tblStudentsAndClasses: StudentID, ClassID, QuarterTaken
In my form, when I remove a major from a student, I want it to delete
two things:
- in tblStudentsAndMajors: remove the record where StudentID (11 as a
test) and MajorID (2 as a test) match StudentID and MajorID from the
form
- in tblStudensAndClasses: remove the records where StudentID and
MajorID match StudentID and MajorID from the form, and where
QuarterTaken is false
DELETE [Students And Majors].*, [Students And Classes].*
FROM (Majors
INNER JOIN ((Classes
INNER JOIN [Classes And Majors]
ON Classes.ClassID = [Classes And Majors].ClassID)
INNER JOIN [Students And Classes]
ON Classes.ClassID = [Students And Classes].ClassID)
ON Majors.MajorID = [Classes And Majors].MajorID)
INNER JOIN [Students And Majors]
ON Majors.MajorID = [Students And Majors].MajorID
WHERE ((([Students And Classes].StudentID)=11)
AND (([Students And Classes].Taken)=False)
AND (([Students And Majors].StudentID)=11)
AND (([Students And Majors].MajorID)=2));
When I do that query, the datasheet view gives me the results I want
(all the line to delete), but if I run the query, I get "Cannot delete
from specified tables".
Does anyone has an idea?
Thanks,
Celine