|
-
Oct 3rd, 2000, 02:27 PM
#1
Thread Starter
New Member
How can I delete all the records of 9 tables?
All 9 tables are in the same .mdb database.
I dont't know if I have to use one ADO(or DAO) for each
table or maybe there is a better way to do that...
I don't know.
All I know is that my SQL should look like this:
"delete from TableName;"
Anybody please help me
I'm not like them
but I can pretend
-
Oct 3rd, 2000, 04:01 PM
#2
Addicted Member
I havent tried this yet but I think you can just use the * wildcard in the sql.
if it doesnt work then you will need to take the * of the FROM and do individual tables but I think that should work for you.
-
Oct 4th, 2000, 03:13 PM
#3
Thread Starter
New Member
I tryed that but it doesn't work (SQL error)
Thank anyway 
Anyone can help me?
I'm not like them
but I can pretend
-
Oct 4th, 2000, 03:41 PM
#4
try this:
Code:
' this code was taken from 101 Tech Tips by VBPJ
Function ZapTable(sTable as STring, Optional sWhere as String = "") as Integer
Dim sSQL as String
On Error GoTo Err_ZapRecs
' For Access Apps only:
' docmd.SetWarnings False
sSQL = "DELETE * FROM " & sTable & " "
If sWhere <> "" Then
sSQL = sSQL & "WHERE " & sWhere
End If
DB.Execute sSQL, dbFailOnError
' docmd.SetWarnings True
ZapTable = True
Exit_ZapRecs:
Exit Function
Err_ZapRecs:
ZapTable = False
''ERROR HANDLING IF DESIRED
Resume Exit_ZapRecs
End Function
hope this helps.
-
Oct 4th, 2000, 03:46 PM
#5
Thread Starter
New Member
What type is DB in your function?
I'm not like them
but I can pretend
-
Oct 4th, 2000, 03:59 PM
#6
whatever database object you have.
-
Oct 4th, 2000, 04:44 PM
#7
Thread Starter
New Member
Hooooooooooooo yeah 
thank you billyboy, your help was just what I needed.
It works perfectly, like I want.
thank you again
I'm not like them
but I can pretend
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|