如何传递参数到访问报告编程? [英] How do I pass a parameter into an access report programatically?

查看:137
本文介绍了如何传递参数到访问报告编程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个现有的Access MDB。我添加一个命令按钮来运行现有的报表现有的格式。正在作出的变化是,这个按钮需要通过在包含记录的ID参数所报告的 - 目前的报告运行在MDB中的每个记录

I've got an existing Access MDB. I'm adding a command button to an existing Form that runs an existing report. The change being made is that this button needs to pass in a parameter containing the ID of the record being reported on - currently the report runs on every record in the MDB.

我已经改变了查询,报告运行在使用参数的ID值,所以现在单击该按钮时,Access提示备案编号汇报,并像它应该的报告显示。

I've altered the Query that the report runs on to use a parameter for the ID value, so that now when the button is clicked Access prompts for the record ID to report on, and the report displays like it should.

不过,我不能为我的生活弄清楚如何将参数传递到报表的查询使用。帮助?

However, I can't for the life of me figure out how to pass a parameter into the report for the query to use. Help?

(我是一个SQL / VB.net的家伙,没有访问的经验,所以道歉前面的给我德codeS的风格问题。此外,谷歌是有点让我失望这一点。太基本的问题?我想是的。)

(I'm a SQL / VB.net guy with no Access experience, so apologies up front for the "send me teh codes" style question. Also, google is kinda letting me down on this one. Too basic a question? I guess so.)

推荐答案

该DoCmd.OpenReport方法有各种争论,其中之一是一个Where语句:

The DoCmd.OpenReport method has various arguments, one of which is a Where statement:

DoCmd.OpenReport"rptReport", acViewPreview,,"ID=" & Me.ID

这是

expression.OpenReport(ReportName, View, FilterName, WhereCondition, WindowMode, OpenArgs)

这篇关于如何传递参数到访问报告编程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆