【问题标题】:MS Access report Pass through query to SQL Server with parameterMS Access 报告通过参数将查询传递给 SQL Server
【发布时间】:2020-07-13 19:11:10
【问题描述】:

我有一个 PDF 报告,当单击表单按钮时会打开该报告。最近我们不得不将数据库迁移到 SQL Server。我在 SQL Server 中有一个需要一个参数的存储过程,我正在尝试从 Ms Access 前端访问该存储过程。任何人都知道该怎么做;从传递查询的语法到报表的打开代码。任何帮助将不胜感激。

【问题讨论】:

标签: sql-server ms-access vba


【解决方案1】:

我假设您还没有使用 2007 年之前的 Access .....

Access 2007
On the Create tab, click Query Design in the Other group.
Click Close in the Show Table dialog box without adding any tables or queries. 
On the Design tab, click Pass-Through in the Query Type workgroup.
Click Property Sheet in the Show/Hide workgroup to display the property sheet for the query.
In the query property sheet, place the mouse pointer in the
ODBC Connect Str property, and then, click the Build (...) button.

With the ODBC Connect Str property, you specify information about the database to which you want to connect. You can type the connection information, or click Build, and then enter information about the server to which you are connecting.
When you are prompted to save the password in the connection string, click Yes if you want the password and logon name to be stored in the connection string information.
If the query is not the type that returns records, set the ReturnsRecords property to No.
In the SQL Pass-Through Query window, type your pass-through query. For example, the following pass-through query uses the Microsoft SQL Server TOP operator in the SELECT statement to return only the first 25 orders in the Orders table from the sample Northwind database:
SELECT TOP 25 orderid from orders
To run the query, click Run in the Results group on the Design tab. For a SQL pass-through query that returns records, click Datasheet view on the status bar.
If necessary, Microsoft Access prompts you for information about your server database.

【讨论】:

    猜你喜欢
    • 2010-11-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-11-25
    • 2014-11-02
    相关资源
    最近更新 更多