HandsOn Generating a List of Saved Views

1. Switch to the Visual Basic Editor window and insert a new module.

2. In the module's Code window, enter the List_Views procedure as shown below.

' Don't forget to set up a reference to the ' Microsoft ADO Ext. 2.7 for DDL and Security

Sub List_Views()

Dim cat As New ADOX.Catalog Dim myView As ADOX.View cat.ActiveConnection = CurrentProject.Connection

For Each myView In cat.Views Debug.Print myView.Name Next myView End Sub

Part III

The List_Views procedure illustrated above writes the names of the existing views to the Immediate window.

0 0

Post a comment