Office中国论坛/Access中国论坛

标题: Do Your Forms Which Have Filter Options Take "Forever" to Close? [打印本页]

作者: tmtony    时间: 2005-8-17 18:51
标题: Do Your Forms Which Have Filter Options Take "Forever" to Close?
标题o Your Forms Which Have Filter Options Take "Forever" to Close? .

原作者:ATTAC Consulting Group

原文网址:http://ourworld.compuserve.com/homepages/attac-cg/AFormTip.htm#KEY

摘抄人:tmtony

翻译人:

Access 97 introduced many new features including the option to filter by form which has carried forward into Access 2000, 2002 and beyond. Many developers also add options and methods to set filters on a form to search for or limit the form's records to a selected set.

In Access 97 and later, forms contain a property called "Filter" and "Filter On" (which applies the filter), which is set each time you set a filter on the form. The problem is that when you close the form with a filter remaining set on the form, that filter is set as the form's "Filter" property, and Access, sensing the form has changed from when it was first opened, saves the form on closing it, which appears to the user to slow down performance.

To rectify this problem is fairly simple since most developer's add a "Close" or "Exit" button to their form. In the code which you use in the event procedure for this button, make sure that you include the "SaveNo" option to the close command as in:

DoCmd.Close  acForm, Me.Name, acSaveNo

Your form will close much faster and preserve the feel of fast performance.

Note: If you are using the control wizards in Access 97 to add the proper code to your command buttons you may need to change the code. Many of Access 97's control wizards place old style Access 2 and 95 "DoCmd.DoMenuItem" code in your event procedures (as witnessed by the A_MENU_VER70 tag,) and this can be updated to the code above.
作者: 爱情插班生    时间: 2005-8-19 23:25
标题: 您的窗体经过筛选关闭后,是不是在其筛选属性上永远残留其筛选条件呢?
标题:您的窗体经过筛选关闭后,是不是在其筛选属性上永远残留其筛选条件呢?

原作者:ATTAC Consulting Group

原文网址:http://ourworld.compuserve.com/homepages/attac-cg/AFormTip.htm#KEY

摘抄人:tmtony

翻译人:爱情插班生









    Access97 介绍许多新特性包括按选定内容窗体筛选保留入Access2000,2002或更高版本。 许多开发者也加入了这样的方法来筛选所需的窗体数据,或对一个选定的集限定其窗体记录.

    在Access97和更高的版本,  窗体包含"筛选"和"开启筛选"两个属性 (用于筛选).在窗体你可以随时设置你的筛选。 但问题恰恰出现在这里,每次在关闭筛选过的窗体时,筛选内容就会保存在其相应的””筛选”属性上.(注:筛选被保存在创建该筛选的对象中。在打开对象的时候将自动加载筛选,但不会自动应用筛选。)这就会影响用户的操作速度。

   矫正这种现象很简单,因为很多开发者都会在窗体加上“关闭”或“退出这样的按钮,按钮事件中一般会用到关闭之类的代码:我们就可以在代码中加上 acSaveNo的参数。如:DoCmd.Close  acForm, Me.Name, acSaveNo

这样你的窗体关闭就会快得多了,操作感觉起来就有一种快感。

    注: 在Access97中,如果您是使用向导来生成按钮代码,那你就有可能需要改一个这些代码了。很多Access97向导用的都是使用Microsoft Access 2.0 和 Microsoft Access 95旧版的命令代码,

如:    DoCmd.DoMenuItem acFormBar, acEditMenu, 7, , acMenuVer70

现在已经更新为上提及的代码了。

(大家可以回家试一下,在窗体某个对象应用筛选后,关闭窗体,在设计窗体观其筛选属性.已经写上了你曾筛选的条件了)



[em01][em01][em01]

[此贴子已经被作者于2005-8-20 10:17:35编辑过]






欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3