Results 1 to 3 of 3

Thread: Delete Query

  1. #1
    2 Star Lounger
    Join Date
    Jun 2005
    Location
    Atlanta, Georgia, USA
    Posts
    208
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hello,

    I have delete query set up where I want fields all fields in 1 table deleted when there is a match on claim ID in the other table in the query but I am receiving an error message(Could not delete from specified tables). What could be happening here?

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='benji' post='762134' date='27-Feb-09 11:18']Hello,

    I have delete query set up where I want fields all fields in 1 table deleted when there is a match on claim ID in the other table in the query but I am receiving an error message(Could not delete from specified tables). What could be happening here?[/quote]
    I would use something like this :
    DELETE Table1.*
    FROM Table1
    WHERE (((DLookUp("ClaimID","table2","[ClaimID]=" & [Table1].[ClaimID])) Is Not Null));
    Francois

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Alternatively, you can use

    DELETE [Claim ID]
    FROM [Table 1]
    WHERE [Claim ID] In (SELECT [Claim ID] FROM [Table 2])

    In design view:
    - Remove Table 2 from the query.
    - Remove all fields except Claim ID from the query grid.
    - In the Criteria line, enter

    In (SELECT [Claim ID] FROM [Table 2])

    You must substitute the correct names, of course.

Posting Permissions

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