PDA

Click to See Complete Forum and Search --> : Delete Multiple Table


SAMS
Oct 7th, 1999, 02:04 PM
Hi guys is there a way to delete multiple table in a single command or any other sugestion?? THKS.

The code for delete one table is as follow:

Dim db As Database
Dim sql As String

Set db = OpenDatabase("c:\p1\data.mdb")
sql = "delete from ACC"
db.Execute sql

Is there another way whereby i could add in a single command line into to above to delete
another table??

e.g:
Dim db As Database
Dim sql As String

Set db = OpenDatabase("c:\p1\data.mdb")
sql = "delete from ACC"
sql = "delete from eACC"
db.Execute sql

Off2Cabo
Oct 7th, 1999, 03:14 PM
Action Query:

Dim db As Database

Set db = Workspaces(0).OpenDatabase("c:\Wherever\Wherever\Database.mdb")

db.Execute "DELETE * FROM Table1"
db.Execute "DELETE * FROM Table2"

db.Close

Set db = Nothing


Hope this helps...........


--Steph


------------------
Email: Off2Cabo@aol.com
"Face Down In The Warm Cabo Sand"


[This message has been edited by Off2Cabo (edited 10-08-1999).]

SmithVoice
Oct 8th, 1999, 12:08 AM
If you've set relationships with cascading deletes and the second table's records match the relationship properties then the seond tables's realted records could "automatically" be deleted.

If not each table gets it's own DELETE query.

------------------
http://www.smithvoice.com/vbfun.htm

SAMS
Oct 8th, 1999, 08:22 AM
Thks guys. It works.