Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Jun 2002
    Posts
    114
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Delete selected customers (Access 2000)

    How can i delete all the records in a table mentioned in another table?
    I refer to the thread 476578 where i updated all the records in a table mentioned in another table.This is done as follows:

    SQL = " UPDATE TblTemp INNER JOIN products ON " & _
    " TblTemp.ProductID" & _
    " = products.Productid SET products.branch = TblTemp.cartons"

    In this way, what i want to do is something like that:

    " delete * from tblClients where Clientid is in table TblTemp
    Is it possible?
    I am also applying an attachment.

  2. #2
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Vancouver, Br. Columbia, Canada
    Posts
    632
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Delete selected customers (Access 2000)

    You were very close...

    delete * from tblClients where Clientid IN (SELECT ClientID from TblTemp)

    You can also do the same thing manually by specifying the exact ID's:
    delete * from tblClients where Clientid IN (4, 5, 6, 9)
    --------------------------------------------------
    Jack MacDonald
    Vancouver, Canada

  3. #3
    2 Star Lounger
    Join Date
    Jun 2002
    Posts
    114
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Delete selected customers (Access 2000)

    Thank you !

  4. #4
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Delete selected customers (Access 2000)

    Another way is:

    DELETE Customers.* FROM Customers INNER JOIN TblTemp ON Customers.Customerid = TblTemp.lineid;

    nb. you do not have tblClients in your attachment, you have Customers instead.

Posting Permissions

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