...

View Full Version : Trying to Delete Records in MS Access



javaspace
01-10-2003, 03:37 PM
Hello:

I use Access to create the Query to delete records here is what I get:

DELETE tblOutbounds.SchAptDate, tblOutbounds.OutboundNum, tblOutbounds.*
FROM tblOutbounds LEFT JOIN Trailers ON tblOutbounds.OutboundNum = Trailers.OutboundNum
WHERE (((tblOutbounds.SchAptDate)<Date()-5) AND ((tblOutbounds.OutboundNum) Not In ([Trailers].[OutboundNum])));

The above query gives me the records I should be deleting, but When I try to run it, it does not delete records.

So I created this SQL. But when I run this I get zero records selected.

SELECT count(*) FROM tblOutbounds WHERE tblOutbounds.SchAptDate < (Date()-5) and tblOutbounds.OutboundNum Not In (select distinct Trailers.OutboundNum from Trailers)


You see in the above SQL what I am intending to do. This SQL will be run from a Web page. Any help would be apprecited.


Thanks

codefox
01-12-2003, 05:37 AM
Do you mean

SELECT tblOutbounds.SchAptDate, tblOutbounds.OutboundNum, tblOutbounds.*
FROM tblOutbounds LEFT JOIN Trailers ON tblOutbounds.OutboundNum = Trailers.OutboundNum
WHERE (((tblOutbounds.SchAptDate)<Date()-5) AND ((tblOutbounds.OutboundNum) Not In ([Trailers].[OutboundNum])));
displays the records but substituting SELECT with DELETE doesn't work? If so, try substituting SELECT tblOutbounds.SchAptDate, tblOutbounds.OutboundNum, tblOutbounds.*
with SELECT *.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum