Microsoft Office Online
Sign in to My Office Online (What's this?) | Sign in

 
 
Microsoft Office Access
Search
Search
 
Check for updates: (c) Microsoft
Office downloads
 
 
 
Warning: You are viewing this page with an unsupported Web browser. This Web site works best with Microsoft Internet Explorer 6.0 or later, Firefox 1.5, or Netscape Navigator 8.0 or later. Learn more about supported browsers.

Email this linkEmail this link Printer-Friendly VersionPrinter-Friendly Version Bookmark and ShareShare
View, modify, or copy a query's SQL statement (MDB)
 

Note  The information in this topic applies only to a Microsoft Access database (.mdb).

If you're familiar with SQL (Structured Query Language (SQL): A database query and programming language widely used for accessing, querying, updating, and managing data in relational database systems.), you might want to work directly with a query's underlying SQL statement (SQL string/statement: An expression that defines an SQL command, such as SELECT, UPDATE, or DELETE, and includes clauses such as WHERE and ORDER BY. SQL strings/statements are typically used in queries and in aggregate functions.). Or, you might want to copy the SQL statement and paste it elsewhere, such as in the RowSource property of a list box in a form or report.

  1. Open the query you want to work with.
  2. Click the arrow next to View Button image on the toolbar, and then click SQL View.

    Microsoft Access displays the SQL statement that is equivalent to what you created in Design view (Design view: A window that shows the design of these database objects: tables, queries, forms, reports, macros, and data access pages. In Design view, you can create new database objects and modify the design of existing ones.).

  3. Do one or more of the following:

    To modify the SQL, type your changes in the SQL statement.

    To copy the SQL, select all or part of the SQL statement, copy the selected text, and paste the SQL statement in, for example, a property box or the Microsoft Visual Basic Editor.

  4. To see the changes in the design grid (design grid: The grid that you use to design a query or filter in query Design view or in the Advanced Filter/Sort window. For queries, this grid was formerly known as the QBE grid.), click the arrow next to the View button on the toolbar, and then click Design View.
advertisement