在访问事件的序列 [英] sequence of events in ACCESS

查看:377
本文介绍了在访问事件的序列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是执行以下操作的正确方法:

what is the proper way of doing the following:

  1. 在收到日期作为用户输入
  2. 在运行查询
  3. 在生成一个使用该查询的报告

这是解决方案,我在想:

this is the solution i was thinking:

  1. 有一个表格,需要用户输入
  2. 运行查询
  3. 打开报告

什么是这样做的正确方法>?

what is the correct way of doing this>?

推荐答案

我的这种做法持不同政见者,因为我不喜欢绑特定形式的报告。

I dissent from this approach, as I don't like tying reports to particular forms.

相反,我用一个对话框的形式(如下),该报告的OnOpen事件开了,并写入报表的记录。

Instead, I use a dialog form (as here) that is opened in the OnOpen event of the report, and writes the Recordsource of the report.

如果您希望报告是可运行时弹出对话框,你可以把它有条件的OpenArgs,或者说,如果过滤器属性已被设置(这是什么情况,如果你使用DoCmd.OpenReport使用WHERE参数)。

If you want the report to be runnable without popping up the dialog, you can make it conditional on OpenArgs, or, say, if the Filter property is already set (which is what happens if you use DoCmd.OpenReport with a WHERE argument).

我想提出的报告和对话尽可能独立,我经常会用一个独立的类模块作为数据存储结构,并检查它的OnOpen事件。如果在类模块的相关实例的公共变量是没什么,然后只需运行报告,否则,从类模块实例的属性提取数据并写入记录源。

I like to make reports and dialogs as independent as possible, and often I'll use a standalone class module as a data storage structure, and check it in the OnOpen event. If the public variable for the relevant instance of the class module is Nothing, then just run the report, otherwise, pull the data from the properties of the class module instance and write the Recordsource.

在这种方式,你可以有对话的形式和完全独立的报告。两者都需要什么都不知道对方,但都将与类模块中使用(尽管形式并不需要了解类模块实例的任何东西)。

In this way, you can have the dialog form and the report completely independent. Both need know nothing about each other, but both will be used with the class module (though the form doesn't need to know anything about the class module instance).

有关更多详细信息,只问。

For more detail, just ask.

这是一个复杂的问题,我已经花了几年时间做这个工作,使应用程序的维护成为可能。相互解耦UI对象是一个使用户可更好的可重用性,并因此事,更好的可维护性和可扩展性。

This is a complicated subject, and I've spent years working on it to make apps as maintainable as possible. Decoupling UI objects from each other is one of the things that makes for better re-usability, and, hence, better maintainability and extensibility.

(当然,你并不需要使用类模块 - 您可以使用用户定义类型,或数组或什么,但我喜欢有相同的结构,这是整点的多个实例的能力一类模块的)

(of course, you don't need to use class modules -- you could use user-defined types, or arrays or whatever, but I like the capability to have multiple instances of the same structure, which is the whole point of a class module)

这篇关于在访问事件的序列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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