Results 1 to 3 of 3
  1. #1
    taimysho0 is offline Competent Performer
    Windows XP Access 2000
    Join Date
    Nov 2011
    Posts
    286

    Help with DELETE QUERY

    hello, im having trouble writing a delete query, when i run it i get a message saying "specify the table you want to delete" even though i did. here is my code below. i want to delete all rows from tblAllCellActivations where values are present in tblAllCellActivation.Assigned Voice # but in qryTrimLPC_Phone_3.Num is null





    DELETE tblAllCellActivations.[Assigned Voice #], qryTrimLPC_Phone3.Num
    FROM tblAllCellActivations LEFT JOIN qryTrimLPC_Phone3 ON tblAllCellActivations.[Assigned Voice #] = qryTrimLPC_Phone3.Num
    WHERE (((qryTrimLPC_Phone3.Num) Is Null));

  2. #2
    taimysho0 is offline Competent Performer
    Windows XP Access 2000
    Join Date
    Nov 2011
    Posts
    286
    ^ or in other words, delete everything in tblallcellactivation where the records dont match qrytrimLPC_Phone3

  3. #3
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Delete Queries often give me headaches when multiple tables are involved too.
    Usually, what I do is to first create a Select query that selects the records I want to do delete. I then use that as the criteria of my delete query.
    So this should work:
    Code:
    DELETE *
    FROM tblAllCellActivations
    WHERE tblAllCellActivations.[Assigned Voice #] IN
    (SELECT tblAllCellActivations.[Assigned Voice #]
    FROM tblAllCellActivations LEFT JOIN qryTrimLPC_Phone3 ON tblAllCellActivations.[Assigned Voice #] = qryTrimLPC_Phone3.Num
    WHERE (((qryTrimLPC_Phone3.Num) Is Null)));
    

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 01-24-2012, 02:16 PM
  2. Trying to Delete record using delete query
    By MooseOTL in forum Access
    Replies: 13
    Last Post: 10-04-2011, 02:30 AM
  3. Replies: 11
    Last Post: 03-30-2011, 01:08 PM
  4. Delete Query
    By jgelpi16 in forum Queries
    Replies: 2
    Last Post: 09-14-2010, 12:16 PM
  5. DELETE query
    By dollygg in forum Queries
    Replies: 1
    Last Post: 04-27-2010, 04:12 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums