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

Chapter 21. Moving from Jet Queries to T... > Using SQL Statements with Forms, Rep...

Using SQL Statements with Forms, Reports, and Controls

If you create many forms and reports based on queries, views, or stored procedures, the query list in your Database window can become cluttered. The clutter becomes worse as you add queries, views, or functions to populate list and combo boxes. You can use SQL queries you write or copy from the SQL dialog in place of the names of query or view objects as the data source for forms, reports, and lists. After you verify proper operation of the object whose data source you changed, delete the corresponding object from your database. You can use Jet SQL or T-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 or view object can give you greater control over the sequence of the columns in your list.

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

  • Source property of an DAO.Recordset object specified as the Recordset property of a Jet form, report, or control. The capability to bind Jet objects to DAO.Recordset objects is new in Access 2002.

  • Source property of an ADODB.Recordset object specified as the Recordset property of a form, report, or control. Access 2000 introduced the capability to bind Jet form and report objects to ADO Recordsets. Access 2002 ADP can use disconnected Recordsets to minimize active connections to the database.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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