Connecting Tech Pros Worldwide Forums | Help | Site Map

Deleting Tables

Nick 'The database Guy'
Guest
 
Posts: n/a
#1: Aug 11 '06
Hello People,

Does anyone know how to browse and delete folders in VBA?

Thanks,

Nick McMillen


Nick 'The database Guy'
Guest
 
Posts: n/a
#2: Aug 11 '06

re: Deleting Tables


Please replace the word folders with tables.

Oops!

Nick 'The database Guy' wrote:
Quote:
Hello People,
>
Does anyone know how to browse and delete folders in VBA?
>
Thanks,
>
Nick McMillen
Arno R
Guest
 
Posts: n/a
#3: Aug 11 '06

re: Deleting Tables


This is a quick and dirty function but...
If you run this function 3 or 4 times all tables in a 'common db' will be deleted.
It depends on the relations, cascading delets and such and how deep the relation-levels are.

Function TryToEmptyDb()
'Will not completely work depending on the relations and/or whether cascading deletes are 'on'
Dim db As Database, i As Integer, strSQL As String
Set db = CurrentDb
For i = 0 To db.TableDefs.Count - 1
Select Case Left(db.TableDefs(i).Name, 4)
Case "MSys" 'Don't delete MSys*
Case Else
strSQL = "Delete * FROM [" & db.TableDefs(i).Name & "]"
db.Execute strSQL
End Select
Next i
Set db = Nothing
End Function

Function EmptyDb()
'After 4 runs a 'common db' will be empty
Dim i As Integer
For i = 1 To 4
Call TryToEmptyDb
Next i

End Function

Arno R


"Nick 'The database Guy'" <nick.mcmillen@eads.comschreef in bericht news:1155289724.895597.102390@i3g2000cwc.googlegro ups.com...
Quote:
Please replace the word folders with tables.

Oops!

Nick 'The database Guy' wrote:
Quote:
>Hello People,
>>
>Does anyone know how to browse and delete folders in VBA?
>
>Thanks,
>
>Nick McMillen
>
Closed Thread


Similar Microsoft Access / VBA bytes