访问自定义属性与全局变量 [英] Access Custom property vs. Global Variable

查看:115
本文介绍了访问自定义属性与全局变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Access 2K。我希望有人能告诉我哪种方法

表现得更快 - (目前我正在使用这两种方法的混合物)


a。)创建自定义属性然后调用要设置的函数和

检索值...(即:

application.currentproject.properties(propName))


b。)以数组的形式创建全局变量并使用

函数来填充和检索它们。


我设置基于用户选择的字符串,数字和布尔值
来自登录表单的
并在

应用程序中经常调用这些值。


谢谢,

lq

解决方案

如果你只需要一个临时的话,可以使用全局变量内存分配'

可用于所有例程。它会更快 - 特别是对于分配

值。)

如果你想要在会话之间存活的东西,请使用自定义属性。


-

Allen Browne - 微软MVP。西澳大利亚州珀斯。

访问用户提示 - http:// allenbrowne.com/tips.html

回复群组,而不是mvps.org上的allenbrowne。


" laurenq uantrell" < LA ************* @ hotmail.com>在消息中写道

news:11 ********************** @ c13g2000cwb.googlegr oups.com ...

我正在使用Access 2K。我希望有人可以告诉我哪种方法表现得更快 - (目前我正在使用两种方法的混合)

a。)创建自定义属性,然后调用函数设置和
检索值...(即:
application.currentproject.properties(propName))
b。)以数组的形式创建全局变量并使用一个
函数来填充和检索它们。

我根据用户从登录表单中选择
设置字符串,数字和布尔值,并在整个过程中经常调用这些值
申请。

谢谢,
lq



艾伦谢谢。

我试图确定是否存在与应用程序中的20个自定义属性相关的开销相关的开销,如果是,那么它是否比必须加载更糟糕来自远程

服务器的数组中的20个全局值。

lq


Allen Browne写道:如果您只需要一个可用于所有例程的临时内存分配
,请使用全局变量。它会更快 - 特别是对于
分配值。)

如果你想要在
会话之间存活的东西,请使用自定义属性。
-
Allen Browne - 微软MVP。西澳大利亚州珀斯。
访问用户提示 - http://allenbrowne.com/ tips.html
回复群组,而非mvps.org上的allenbrowne。

" laurenq uantrell" < LA ************* @ hotmail.com>在消息中写道
新闻:11 ********************** @ c13g2000cwb.googlegr oups.com ...

我正在使用Access 2K。我希望有人可以告诉我哪种方法表现得更快 - (目前我正在使用两种方法的混合)

a。)创建自定义属性,然后调用函数设置
并检索值...(即:
application.currentproject.properties(propName))
b。)以数组的形式创建全局变量并使用一个
函数来填充和检索它们。

我根据用户从登录表单中选择
设置字符串,数字和布尔值,并在整个过程中经常调用这些值
申请。

谢谢,
lq




分配一个对于属性的值将比为

变量赋值更慢。


您的代码是否需要检查属性是否已存在,并创建

如果没有?还有额外的开销。


除非你反复设置

,否则差异可能仅为20学分。


-

Allen Browne - 微软MVP。西澳大利亚州珀斯。

访问用户提示 - http:// allenbrowne.com/tips.html

回复群组,而不是mvps.org上的allenbrowne。


" laurenq uantrell" < LA ************* @ hotmail.com>在消息中写道

news:11 ********************* @ z14g2000cwz.googlegro ups.com ...

我正在尝试确定是否存在与应用程序中有20个自定义属性相关的开销,如果是这样,是否比不得不更糟糕从远程服务器加载20个全局值。
lq

























临时内存分配


所有例程都可以使用

。它会更快 - 特别是对于


分配

值。)

如果你想要的东西存在于
会话。


" laurenq uantrell" < LA ************* @ hotmail.com>在消息中写道
新闻:11 ********************** @ c13g2000cwb.googlegr oups.com ...

>我正在使用Access 2K。我希望有人能告诉我哪种方法
>表现得更快 - (目前我正在使用这两种方法的混合物)
>
> a。)创建自定义属性,然后调用要设置的函数和>检索值...(即:
> application.currentproject.properties(propName))
>
> b。)以数组的形式创建全局变量并使用
>用于填充和检索它们的功能。
>
>我根据用户选择设置字符串,数字和布尔值
>从登录表单中经常调用这些值
>申请。
>
>谢谢,
> lq
>



I''m using Access 2K. I''m hoping someone can tell me which method
performs faster- (currently I''m using a mix of both methods)

a.) creating custom properties and then calling functions to set and
retrieve the values... (ie:
application.currentproject.properties(propName))

b.) creating global variables in the form of an array and using a
function to populate and retrieve them.

I set string, numeric and boolean values based on the user selected
from a sign-in form and call these values frequently throughout the
application.

Thanks,
lq

解决方案

Use a global variable if you just need a temporary memory assignment that''s
available to all routines. It will be faster - particularly for assigning a
value).

Use a custom property if you want something that survives between sessions.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps.org.

"laurenq uantrell" <la*************@hotmail.com> wrote in message
news:11**********************@c13g2000cwb.googlegr oups.com...

I''m using Access 2K. I''m hoping someone can tell me which method
performs faster- (currently I''m using a mix of both methods)

a.) creating custom properties and then calling functions to set and
retrieve the values... (ie:
application.currentproject.properties(propName))

b.) creating global variables in the form of an array and using a
function to populate and retrieve them.

I set string, numeric and boolean values based on the user selected
from a sign-in form and call these values frequently throughout the
application.

Thanks,
lq



Allen thanks.
What I am trying to determine if there is an overhead associated with
having say 20 custom properties in the application, and if so, is it
worse than having to load 20 global values in an array from a remote
server.
lq

Allen Browne wrote:

Use a global variable if you just need a temporary memory assignment that''s available to all routines. It will be faster - particularly for assigning a value).

Use a custom property if you want something that survives between sessions.
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps.org.

"laurenq uantrell" <la*************@hotmail.com> wrote in message
news:11**********************@c13g2000cwb.googlegr oups.com...

I''m using Access 2K. I''m hoping someone can tell me which method
performs faster- (currently I''m using a mix of both methods)

a.) creating custom properties and then calling functions to set and retrieve the values... (ie:
application.currentproject.properties(propName))

b.) creating global variables in the form of an array and using a
function to populate and retrieve them.

I set string, numeric and boolean values based on the user selected
from a sign-in form and call these values frequently throughout the
application.

Thanks,
lq




Assigning a value to a property will be slower than assigning a value to a
variable.

Will your code need to check whether the property already exists, and create
it if it does not? There''s extra overhead in that also.

The difference may be academic for just 20 values, unless you are setting
them repeatedly.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps.org.

"laurenq uantrell" <la*************@hotmail.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...

Allen thanks.
What I am trying to determine if there is an overhead associated with
having say 20 custom properties in the application, and if so, is it
worse than having to load 20 global values in an array from a remote
server.
lq

Allen Browne wrote:

Use a global variable if you just need a temporary memory assignment


that''s

available to all routines. It will be faster - particularly for


assigning a

value).

Use a custom property if you want something that survives between


sessions.


"laurenq uantrell" <la*************@hotmail.com> wrote in message
news:11**********************@c13g2000cwb.googlegr oups.com...

> I''m using Access 2K. I''m hoping someone can tell me which method
> performs faster- (currently I''m using a mix of both methods)
>
> a.) creating custom properties and then calling functions to set and > retrieve the values... (ie:
> application.currentproject.properties(propName))
>
> b.) creating global variables in the form of an array and using a
> function to populate and retrieve them.
>
> I set string, numeric and boolean values based on the user selected
> from a sign-in form and call these values frequently throughout the
> application.
>
> Thanks,
> lq
>



这篇关于访问自定义属性与全局变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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