Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2005
    Posts
    6

    Unanswered: deletion from multiple tables

    hi
    i m newto access 2000,in want to know how to delete records from multiple tables using access forms and thier controls......wat is the code to write using delete button ,so all record from all tables must be deleted.....let u know that i m using wizard to create buttons.......
    thanx.

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    if you want to delete from multiple tables at the same time then you prabably want ot be using transactions (ie all changes succeed or all fail)

    I'm not sure you can do this using a wizard. I'd do it by executing however many sql statements as there are tables to delete

    overview....
    start transaction
    delete * from tablex where criteria=????
    delete * from tabley where criteria=????
    delete * from tablez where criteira=????
    end transaction
    //insert error handling to rollback the transcation if errors detected


    place the code in a function, call the function from a command button, or macro

  3. #3
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    If you have repationship between your tables, and you delete records form the master table using the sql (DELETE * FROM yourTable WHERE .....) then the affected recordes in the other tables will be also deleted..

  4. #4
    Join Date
    Feb 2005
    Posts
    6

    i wanna know that code

    exactly i wanna that deletion code........so i would use tat in function and call behind button





    Quote Originally Posted by healdem
    if you want to delete from multiple tables at the same time then you prabably want ot be using transactions (ie all changes succeed or all fail)

    I'm not sure you can do this using a wizard. I'd do it by executing however many sql statements as there are tables to delete

    overview....
    start transaction
    delete * from tablex where criteria=????
    delete * from tabley where criteria=????
    delete * from tablez where criteira=????
    end transaction
    //insert error handling to rollback the transcation if errors detected


    place the code in a function, call the function from a command button, or macro

  5. #5
    Join Date
    Feb 2005
    Posts
    6

    i wanna know that code

    exactly i wanna that deletion code........so i would use tat in function and call behind button

Posting Permissions

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