In the previous chapter, we looked at how to handle queries and QueryDef objects. In this chapter we will look at ways to work with tables and how to change their structures programmatically as using the IDE GUI. In particular, we will be looking at the DAO object TableDef . We will also look at some other ways to build and modify tables such as using XML and sub- datasheets .
Modifying tables at run time can be a very useful tool. It potentially allows tables to be altered as and when the user 's requirements change, without having to wait for a database administrator to make the changes for them manually. It can be used to create and destroy tables on-the-fly , perhaps in order to store temporary data. It also allows you to write code that can then be shipped to the client and run on their data in situ - very useful for maintenance updates.
The main topics that we will cover in this chapter are:
Create a table complete with a number of fields and indices using the DAO hierarchy.
Adding a new field to an existing table.
Creating a table by importing an XML schema.
Sub-datasheets - what they are and how to use them.