• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 23. Working with Structured Quer... > Using SQL Statements in Forms, Repor...

Using SQL Statements in Forms, Reports, and Macros

If you create a large number of forms and reports based on queries or that use queries, or if you use macros to run Select and Action queries, the query list in your Database window can become cluttered. You can use SQL queries you write or copy from the SQL dialog in place of the names of query objects and then delete the query from your database. You can use SQL statements for the following purposes:

  • Record Source property of forms and reports. Substitute the SQL query text for the name of the query in the Record Source text box.

  • Row Source property in lists and drop-down combo lists on a form. Using an SQL statement rather than a query object gives you greater control over the sequence of the columns in your list.

  • Value of the SQL property of a QueryDef object or the str Sourceargument of the OpenRecordset method in Access VBA code. You use SQL statements extensively as property and argument values when programming applications with Access VBA, especially for SQL pass-through queries.

  • Argument of the RunSQL() macro action. Only SQL statements that create action queries can be used with the RunSQL() macro action. Using macros is discouraged in Access 97.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint