将参数传递给查询和报告 [英] Passing parameters to query and report

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

问题描述

我在表单上有一个按钮,用于将参数传递给查询并打开报表。下面列出了代码(很久以前有人帮我这个,我保留了它并重复使用它)。这没有问题,但我需要做的是传递[dtmStartDate]和[dtmEndDate],它们都会在查询中传递给[dtmSessionDate]到打开的报告。


由于两个字段都被传递到查询中的字段[dtmSessionDate],我不知道我的报告或代码中需要什么,以使其显示如下:从句点:[dtmStartDate]到期间: [dtmEndDate]在我的报告中。


任何人都可以帮助我吗?在此先感谢。

I have a button on a form that passes parameters to a query and opens a report. The code is listed below (someone helped me with this a long time ago and I kept it and reuse it). This works without a problem but what I need to do is also pass [dtmStartDate] and [dtmEndDate] which both get passed to [dtmSessionDate] in the query to the report that is opened.

Since both fields are being passed to the field [dtmSessionDate] in the query I don’t know what I need on my report or in the code to make it show up like the following: “From Period: [dtmStartDate] To Period: [dtmEndDate] on my report.

Can anyone help me? Thanks in advance.

展开 | 选择 < span class =codeDivider> | Wrap | 行号

推荐答案

可能有更简洁的方法,但这是我会做什么:


在报告上放置一个文本框,其中包含从期间:[dtmStartDate]到期间:[dtmEndDate] 并将其命名为txtDatePeriod 。现在将以下代码行放在
There is probably a cleaner way to do it, but this is what I would do:

Put a textbox on the report that will hold your From Period: [dtmStartDate] To Period: [dtmEndDate] and name it txtDatePeriod. Now put the following line of code in both the
展开 | 选择 | Wrap | < span class =codeLinkonclick =LineNumbers(this);>行号


感谢您的帮助。我做了你说的但是在txtDatePeriod上收到编译错误。找不到方法或数据成员。


这是更改后的代码。

Thank you for helping me. I did what you said but am receiving a compile error on txtDatePeriod. Method or data member not found.

Here is the changed code.

展开 | 选择 | 换行 | 行号


发布代码时请使用代码标签。这是你的第二次警告。


赛斯的代码只是一个如何做的例子。只有在您的表单上有一个名为txtDatePeriod的控件来存储它时,它才会起作用。从错误消息中可以清楚地看出,你没有控制权。
Please use code tags when posting code. This is your second warning.

Seth''s code is only an example of how to do it. It will only work if you have a control on your form named txtDatePeriod to store it. From the error message, it is clear that you don''t have said control.


这篇关于将参数传递给查询和报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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