Send commands to an SQL database using a pass-through query

Send commands to an SQL database using a pass-through query

Microsoft Access pass-through queries send commands directly to an ODBC database server (such as Microsoft FoxPro). With pass-through queries, you work directly with the tables on the server instead of linking to them.

  1. In the Database window, click Queries under Objects, and then click New on the Database window toolbar.

  2. In the New Query dialog box, click Design View, and then click OK.

  3. Without adding tables or queries, click Close in the Show Table dialog box.

  4. On the Query menu, point to SQL Specific, and then click Pass-Through.

  5. On the toolbar, click Properties to display the query property sheet.

  6. In the query property sheet, set the ODBCConnectStr property to specify information on the database to which you want to connect. You can type the connection information, or click Build , and then enter information about the server you're connecting to.

    For details on the syntax for your query, see the documentation for the SQL database server to which you're sending the query.

  7. If the query isn't the type that returns records, set the ReturnsRecords property to No.

  8. In the SQL Pass-Through Query window, type your pass-through query.

  9. To run the query, click Run on the toolbar. (For a pass-through query that returns records, you can click View on the toolbar, instead.)

    If necessary, Microsoft Access prompts you for information about your Microsoft SQL server database.

    Caution   If you convert a pass-through query to another type of query, such as a select query, you'll lose the SQL statement that you entered.

Notes