I've got a database open with a table of accidents, vehicles and casualties.
I want to delete all the records from the accidents table that a from a year that the user enters. The year is in a column called [Date] dd/mm/yyyy. I'm having problems trying to delete the records because I can't seem to get the syntax correct. I've tried deleting records from other columns and that works fine, so I must be having problems with the wildcard and like syntax. Someone suggested using datepart, but couldn't get that right either. Here's what I tried
sSQL = "DELETE * FROM [Attendant circumstances] WHERE [Date]LIKE '*' " & txtYear.Text
then I want to delete all records from Casualties table if they have a Crash reference number which does not exist in the corresponding crash reference column in Attendant circumstances table. e.g if 12345 was in the crash ref field in casualty details but not in attendent circumstances!crash reference then I would like the entire row to be deleted.
sSQL = "DELETE * FROM [Casualty Details] WHERE [Casualty Details]![Crash Reference] NOT IN ([Attendant circumstances]![Crash Reference])"
sorry if this is easy, but i'm having problems.