In the previous chapter, we looked at how recordsets are created and how we can move through records within a recordset one at a time, giving us a much finer degree of control than we have with macros. In this chapter, we will look at some of the other DAO objects - in particular the QueryDef object - and how, as developers, we are able to manipulate them to our best advantage.
Here, we will be concentrating on methods of creating queries at run time. This is a particularly useful technique which can allow users a great deal of freedom over the types of query they want to produce, without the developer having to relinquish too much control. The main topics that we will consider are:
Creating queries at run time
Displaying records selected at run time
Modifying the form's record source
Using Structured Query Language (SQL)
Creating a table of matching records