The SQL Wizard is a powerful tool that makes it easy to create sophisticated SQL statements to obtain the data you want to display or to add and update your databases. You do not need to know SQL statement syntax; the Wizard builds the statement for you. With the SQL Wizard, you can quickly:
- Select tables
- Select columns
- Filter rows using a point-and-click interface to specify selection criteria.
- Sort data by column value.
- Return unique rows only.
Creating statements with the SQL Wizard begins in the Record Source tab of the Data Control OLE Properties dialog box. The Run SQL Wizard button is available only when the selected Command Type is SQL Command. The SQL Wizard gives you the choice to create Select, Insert, or Update statements.
SQL Wizard Select Operation
The SQL Wizard walks you through the process of creating an SQL statement. When you click the Next button in the Wizard, the Wizard uses the options you selected in the current dialog box to build the information displayed in the next dialog box. If you want to backtrack and select different choices, click the Back button. At any point in the Wizard, you can click Finish to complete your query.
The SQL Wizard asks you to select:
- The tables to query, add to, or update.
- The columns in those tables to query, add to, or update, and whether those columns should have unique values.
- The selection criteria to use to filter rows in a Select or Update statement.
- Columns upon which the table data is sorted in a Select statement.
When you finish the statement, the SQL Wizard displays the SQL statement it has built, first in the Finish dialog box of the SQL Wizard, and in a text box on the Record Source tab of the Data Control OLE Properties dialog box. You can edit the finished statement in either of these places. The following list itemizes some common edits you may need to perform:
- To filter rows based on one or another comparison expression in the Where clause, change the AND keyword to OR.
- In a Select statement that joins two or more tables, remove quotation marks surrounding the column name in the Where clause.