Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Sep 2002
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Trying to Delete Records in MS Access

    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

  • #2
    Regular Coder
    Join Date
    Nov 2002
    Location
    India
    Posts
    159
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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 *.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •