HandsOn Listing All Saved Queries in a Database

1. In the Visual Basic Editor window, choose Insert | Module.

2. In the module's Code window, type the List_SavedQueries procedure shown below.

3. Choose Run | Run Sub/UserForm to execute the procedure.

Sub List_SavedQueries()

Dim cat As New ADOX.Catalog Dim v As ADOX.View Dim strPath As String strPath = CurrentProject.Path & "\Northwind.mdb" cat.ActiveConnection = "Provider=Microsoft.Jet.OleDb.4.0;" & _ "Data Source= " & strPath

For Each v In cat.Views

Debug.Print v.Name Next

Set cat = Nothing End Sub

0 0

Post a comment