deleting from more than 1 table

Results 1 to 7 of 7

Thread: deleting from more than 1 table

  1. #1
    AStuPid Guest

    Default deleting from more than 1 table

    Ok I&#039;ve been working through this one step at a time. So far so good thanks to Desert Ghost.<BR><BR>Here is my delete statement.<BR><BR>SQL = "Delete * FROM TRS WHERE entered &#060; #"& deletedate & "# and prior &#060;&#062; 5"<BR><BR>Now I have 2 other tables named TRSED and TRSAD that have records that are tied to the TRS table via an ID. By that I mean that the ID field, not auto-numbered, for records in the 2 tables is the same as the auto-number ID in the TRS table. Any help on getting the single table delete statement above to delete the corresponding records in the other 2 tables would be appreciated.

  2. #2
    Join Date
    Dec 1969

    Default RE: deleting from more than 1 table

    Go to and click on the link to download the sqlbol.chm.<BR><BR>This is a help file and a great resource for the kind of questions you are asking.<BR><BR>

  3. #3
    AStuPid Guest

    Default Okay

    I didn&#039;t know this kind of thing existed. Thanks

  4. #4
    Reggie Guest

    Default RE: deleting from more than 1 table

    Before you do that DELETE, do a SELECT and lookup the IDs of the records you are deleting and store them in an array. Then do the DELETE that you listed above, then cycle through and delete all the records that match the IDs in your array.

  5. #5
    AStuPid Guest

    Default Thanks but

    I&#039;m new to this and that seems outside my experience.

  6. #6
    AStuPid Guest


    That file was HUGE it would have taken me over an hour to download it. Isn&#039;t there a better resource than that?

  7. #7
    Join Date
    Dec 1969

    Default RE: Thanks but

    Do what Reggie said but use In<BR><BR>Get your recordid&#039;s in an array<BR><BR>example<BR>RSID="2,4,7,9,10"<BR><BR>D elete TableName.* From TableName Where RecordId In(RSID)

Posting Permissions

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