Question : Delete subjob record when delete main table record

I want to have a record deleted from the subjob table when deleting the main table record with a delete record button on the main form.  Here's my code but it must not be quite right...

CurrentDb.Execute "Delete * from tblJobScheduleDetail where JobN = " & Me.cboJobN & ";"

--Steve

Answer : Delete subjob record when delete main table record

if you have set the relatioship of the tables and selected the Cascade Delete Related Records check box any time that you delete records in the primary table, Microsoft Access automatically deletes related records in the related table.

if not, then this looks good
CurrentDb.Execute "Delete * from tblJobScheduleDetail where JobN = " & Me.cboJobN & ";"

you will need another delete statement for the other table
 
Random Solutions  
 
programming4us programming4us