7.8. Creating Schema Objects with ADOX

So far we've been working with the ADODB library, which is the library to use when you want to work with database data. The ADOX library is the one you use when you want to work with the database schema, such as tables, views (queries), indexes, and so on.

To implement ADOX, you need to add a reference to it. Open any code module by pressing Alt+F11, and select References from the Tools menu. The References dialog box is displayed. Locate and select ADO Ext. 2.7 for DDL and Security, and click OK.

7.8.1. The ADOX Object Model

As you can see from Figure 7-6, the ADOX model contains one top-level object, the Catalog object, which contains five collections: Tables, Groups, Users, Procedures, and Views.

Figure 7.6. Figure 7-6

Each of the Table, Index, and Column objects also has a standard ADO Properties collection, as shown in Figure 7-7

Figure 7.7. Figure 7-7

7.8.2. Working with Queries (Views)

Since ADO is part of Microsoft's UDA strategy, it was felt that the term query failed to adequately describe the mechanism for retrieving data from a source that could be almost anything. As described earlier, ADO can retrieve data from many different sources, not just the Jet database engine, so the term view was adopted in ADO to more accurately ...

Get Access 2003 VBA Programmer's Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.