本文介绍了CurrentUser()返回null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


当从表单事件处理程序调用时,CurrentUser()返回null,

至少来自Form_Open()!


但是,它在其他形式下工作正常!


使用Application.CurrentUser似乎工作,但我宁愿得到

CurrentUser()工作,因为有很多电话。


感谢您的阅读,


Mourad

解决方案



我的猜测是你有一个名为CurrentUser的东西在范围内

,当你从这个表格中调用它时公开赛。你有控制,

字段,还是名为CurrentUser的变量?


-

Dirk Goldgar,MS Access MVP



(请回复新闻组)





如果是CurrentUser你所指的功能是内置功能,我不希望调试器进入它。


如果单击Debug - >在VB编辑器中编译,是否发现任何编译错误?

它以其他形式工作但不是以特定形式工作的事实

强烈建议那个特定形式的东西是问题所在。如果您创建一个新数据库,将该表单和任何必要的支持表,查询和模块导入其中,是否需要调用

CurrentUser在表单上工作数据库?


如果没有,如果你想给我发一个(压缩)的数据库副本看看

at,你可以发送给通过删除NO SPAM获得的地址和

" .invalid"来自此消息的回复地址。


-

Dirk Goldgar,MS Access MVP



(请回复新闻组)


Hi All,

CurrentUser() returns null when called from a form event handler, at
least from Form_Open()!

However, it works fine in other forms!

Use Application.CurrentUser seem to work, but I''d rather get
CurrentUser() to work, since there are so many calls to it.

Thanks for reading,

Mourad

解决方案


My guess is that you have something else named CurrentUser that is in scope
at the time you call it from this form''s Open event. Do you have a control,
field, or variable named CurrentUser?

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)




If the "CurrentUser" function you are referring to is the built-in one, I
wouldn''t expect the debugger to step into it.

If you click Debug ->Compile in the VB editor, are any compile errors found?

The fact that it works in other forms but not in one particular form
strongly suggests that there''s something about that particular form that is
the problem. If you create a new database, import that form and any
necessary supporting tables, queries, and modules into it, does the call to
CurrentUser work on the form in that database?

If not, and if you want to send me a (zipped) copy of that database to look
at, you can send it to the address you get by removing "NO SPAM" and
".invalid" from the reply address of this message.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


这篇关于CurrentUser()返回null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 11:57