In this chapter, we have spent a good deal of time looking at the different methods that we can use to manipulate QueryDef objects at run time. The first part of the chapter was concerned with how to generate criteria to restrict the display of the records we needed. We used the user 's input to create a SQL string using the BuildSQLString procedure.
Once we had created the SQL string, we had two choices for displaying the records we wanted to display:
Base the frmSales and rptSales objects on a saved query and modify the query before we opened the form and report
Create a table of matching records and use this in the record source for the sales form and report
You should have realized by this stage that the key to the whole thing is the Data Access Object hierarchy. If you have a sound knowledge of how this fits together, you should have little problem putting into practice any of the techniques we have used in this chapter.
Knowledge of SQL is also very important. It's a big subject, and we've only really scratched the surface. Hopefully, you've seen how useful it can be. It's definitely something that you should consider learning if you intend to use run-time queries at all.
If you work at these two areas, you will find that you become more and more inventive with the things you attempt and the results you achieve.