My DB is dependent on a linked spreadsheet to update a table. The spreadsheet is update weekly. The main table in my DB was created on the original data from the spreadsheet and with updates to the spreadsheet may need records added and/or removed. The addition part is easy. But the Deletion part is causing problems.
So, I created a compare query to determine which records need to be deleted. I then have another query that produces the final records/fields to be deleted (Not all fields from the spreadsheet are used).
I then attempted a delete query for the main table Where the items to be deleted are based on the final query (above)
Here is the code:
I understand the select statement must identify the table that will have records deleted...google tells me this. I have tried several ways to redo the query without success.
Can anyone please show me how to format the Delete query correctly for this case. I don't work with delete queries very often.
Thanks,
So, I created a compare query to determine which records need to be deleted. I then have another query that produces the final records/fields to be deleted (Not all fields from the spreadsheet are used).
I then attempted a delete query for the main table Where the items to be deleted are based on the final query (above)
Here is the code:
Code:
DELETE [Current_Quals_tbl Copy] AS Expr1, [Current_Quals_tbl Copy].[User Name], [Current_Quals_tbl Copy].Qualification, [Current_Quals_tbl Copy].[B1/AF], [Current_Quals_tbl Copy].[B2/AV], [Current_Quals_tbl Copy].[Issue Date], [Current_Quals_tbl Copy].[Expiration Date]
FROM [Current_Quals_tbl Copy] INNER JOIN Breakout_IPSS_Remove ON ([Current_Quals_tbl Copy].[User Name] = Breakout_IPSS_Remove.[User Name]) AND ([Current_Quals_tbl Copy].Qualification = Breakout_IPSS_Remove.Qualification) AND ([Current_Quals_tbl Copy].[B1/AF] = Breakout_IPSS_Remove.[B1/AF]) AND ([Current_Quals_tbl Copy].[B2/AV] = Breakout_IPSS_Remove.[B2/AV]) AND ([Current_Quals_tbl Copy].[Issue Date] = Breakout_IPSS_Remove.[Issue Date]) AND ([Current_Quals_tbl Copy].[Expiration Date] = Breakout_IPSS_Remove.[Expiration Date])
WHERE ((([Current_Quals_tbl Copy].[User Name])=[Breakout_IPSS_Remove]![User Name]) AND (([Current_Quals_tbl Copy].Qualification)=[Breakout_IPSS_Remove]![Qualification]) AND (([Current_Quals_tbl Copy].[B1/AF])=[Breakout_IPSS_Remove]![B1/AF]) AND (([Current_Quals_tbl Copy].[B2/AV])=[Breakout_IPSS_Remove]![B2/AV]) AND (([Current_Quals_tbl Copy].[Issue Date])=[Breakout_IPSS_Remove]![Issue Date]) AND (([Current_Quals_tbl Copy].[Expiration Date])=[Breakout_IPSS_Remove]![Expiration Date]));
I understand the select statement must identify the table that will have records deleted...google tells me this. I have tried several ways to redo the query without success.
Can anyone please show me how to format the Delete query correctly for this case. I don't work with delete queries very often.
Thanks,