Results 1 to 5 of 5
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Brookline, Massachusetts, USA
    Posts
    606
    Thanks
    17
    Thanked 0 Times in 0 Posts

    Deleting Records (OXP SR-2)

    I have two tables: (1) tblToo_Many_Names and (2) tblRemovableNames. Table 1 includes all the records from table 2. I want to use table 2 to delete the matching records from table 1. The matching records have the same ID#. This is like a reverse Append Query. How do I do this?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Deleting Records (OXP SR-2)

    Create a query based on tblToo_Many_Names.
    Add the ID field to the query grid.
    Enter the following in the Criteria line for the ID column, substituting the correct field and table names:

    In (SELECT [ID] FROM [tblRemovableNames])

    Switch to datasheet view to verify that the correct IDs are selected, then switch back to design view.
    Change the query into a Delete query (Query | Delete Query)
    Run the query (Query | Run)

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Brookline, Massachusetts, USA
    Posts
    606
    Thanks
    17
    Thanked 0 Times in 0 Posts

    Re: Deleting Records (OXP SR-2)

    Thanks, Hans. One question: Do I have to add tblRemovableNames to the Query or does the Select statement find the table by itself?

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Deleting Records (OXP SR-2)

    You should NOT add tblRemovableNames to the query. The SELECT in the criteria line specifies the table to be used; it constitutes a subquery within the main query.

  5. #5
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Brookline, Massachusetts, USA
    Posts
    606
    Thanks
    17
    Thanked 0 Times in 0 Posts

    Re: Deleting Records (OXP SR-2)

    Worked like a charm. Thanks for the help. Now I can add the SELECT statement to my arsenal.
    Howard

Posting Permissions

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