Article ID: 207562
Article Last Modified on 7/1/2004
Option Explicit
Private Sub Form_Load()
Dim MyRecordSet
Dim lMyRecordCount As Long
Dim lRecordIndex As Long
Dim sMyTable As String
'initialize controls
Command1.Caption = "Drop Selected Tables"
Form1.Caption = "CE Drop Tables"
Command1.Move 60, 1920, 4695, 495
List1.Move 60, 60, 4695, 1815
Form1.Move 0, 0, 4950, 2880
' Load the ListBox with the Names of Non-System Tables.
Form1.List1.Clear
Set MyRecordSet = CreateObject("ADOCE.Recordset")
MyRecordSet.Open "MSysTables", "", 1, 3
lMyRecordCount = MyRecordSet.RecordCount
For lRecordIndex = 0 To lMyRecordCount - 1
sMyTable = MyRecordSet.Fields("TableName").Value
If Mid(sMyTable, 1, 4) <> "MSys" Then
Form1.List1.AddItem sMyTable
End If
MyRecordSet.MoveNext
Next
MyRecordSet.Close
End Sub
Sub Command1_Click()
Dim iIndex As Integer
Dim MyRecordSet
Set MyRecordSet = CreateObject("ADOCE.Recordset")
For iIndex = Form1.List1.ListCount - 1 To 0 Step -1
If Form1.List1.Selected(iIndex) Then
MyRecordSet.Open "DROP TABLE [" & _
Form1.List1.List(iIndex) & "]", , 2, 3
Form1.List1.RemoveItem (iIndex)
End If
Next
End Sub
Note that the CreateObject statements may need to be changed depending on whether you have ADOCE 3.0 or 3.1 on your computer.
196034 How To Use ADOFILTR.DLL to Transfer Database Tables
221594 How To Populate a ListView With an ADOCE Recordset in VBCE6
265796 How To Run ADOCE on the Pocket PC Platform
241402 How To Run ADOCE on a Palm-Size PC Device
Additional query words: vbce vbce6 evb adoce
Keywords: kbhowto kbtoolkit kbcodesnippet KB207562