Hi,
I'm running Access 2007. My database has four main tables:
tblStudent
tblAPR
tblService
tblStudentService
tblStudentService is a junction table between tblStudent and tblService. It has tblStudentServiceID as a PK and StudentID(pk of tblStudent) and ServiceID (pk of tblService) as foreign keys.
The problem I'm having is I want to put a delete button on my parent form, which is based on tblStudent. If the user clicks the button I want all the records from all four tables deleted. I've been using db.Execute commands to delete the data from the current record from all the tables in sequential order, child first then parent. This works on three out of the four tables, but no matter what I do I cannot get the records from tblService to delete.
This is the only table that does not have StudentID as either a primary or foreign key, I thought this would be resolved through the junction table. I think that's the issue, but I'm unsure how to resolve it. I don't want to have to manually go in and delete the data from tblService because it would defeat the purpose of the button. When my db.Execute didn't work, I tried a delete query but that didn't work either. I can't figure out what to do and would appreciate any ideas you'd be able to give me. Thank you!
I'm running Access 2007. My database has four main tables:
tblStudent
tblAPR
tblService
tblStudentService
tblStudentService is a junction table between tblStudent and tblService. It has tblStudentServiceID as a PK and StudentID(pk of tblStudent) and ServiceID (pk of tblService) as foreign keys.
The problem I'm having is I want to put a delete button on my parent form, which is based on tblStudent. If the user clicks the button I want all the records from all four tables deleted. I've been using db.Execute commands to delete the data from the current record from all the tables in sequential order, child first then parent. This works on three out of the four tables, but no matter what I do I cannot get the records from tblService to delete.
This is the only table that does not have StudentID as either a primary or foreign key, I thought this would be resolved through the junction table. I think that's the issue, but I'm unsure how to resolve it. I don't want to have to manually go in and delete the data from tblService because it would defeat the purpose of the button. When my db.Execute didn't work, I tried a delete query but that didn't work either. I can't figure out what to do and would appreciate any ideas you'd be able to give me. Thank you!