如何在MS Access表单中获取我当前的用户登录 [英] How to get my current user logon in MS Access forms

查看:120
本文介绍了如何在MS Access表单中获取我当前的用户登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经进行了初始表单登录,以验证用户详细信息以访问我的MS Access数据库.

I have initial form logon to Validate user details to access my MS Access database.

现在我有另一种形式的要求,如果我从组合框中选择了同一登录用户,则应该在该表单中启用命令按钮,以便如何验证我的初始登录用户,该用户使用另一种形式登录了我的访问数据库中的文本框.

Now I have a requirement in another form, If I choose same logon user from a combo box then command button should be enabled in the form so how I validate my initial logon user who logged in with another form Textbox in my access db.

因此,我对此进行了研究,但未能获得有用的方案-能否请一些人帮我实现这些细节..谢谢!

So I researched about this but could not get the useful scenario - Can some please help me how I can acheive this details ..Thanks!

推荐答案

用户完成登录后,请隐藏而不是关闭登录表单.隐藏表单后,其他表单中的代码仍可以从登录表单中读取值.

After the user completes her login, hide rather than close the login form. With the form hidden, code in your other form can still read values from the login form.

隐藏名为frmLogin的表单:

To hide a form named frmLogin:

DoCmd.OpenForm "frmLogin",acNormal,,,,acHidden

DoCmd.OpenForm "frmLogin",acNormal,WindowMode:=acHidden

如果隐藏的frmLogin包含一个名为txtUserName的文本框,则可以按以下方式检查其值:

If the hidden frmLogin includes a text box named txtUserName, you can inspect its value like this:

Debug.Print Forms!frmLogin!txtUserName

我基于您在Access数据库应用程序中创建了自己的安全框架的假设得出了这个答案.但是,这一点尚不清楚.如果您使用的是Access ULS(用户级安全性),它需要较旧的MDB格式的数据库,则Matt提到的CurrentUser()函数将为您提供用户的Access安全性名称.但是,如果您使用的是这种方法,那么我不明白您为什么需要单独的登录表单.

I based this answer on the assumption you created your own security framework in your Access database application. But that point is unclear. If you're using Access ULS (user level security), which requires the older MDB format database, the CurrentUser() function which Matt mentioned will give you the user's Access security name. However, if that is the approach you're using, I don't understand why you would need a separate login form.

因此您的问题不清楚.如果没有一个令人满意的答案,请编辑您的问题,以包括对您所使用的安全性/登录策略的说明.

So your question is unclear. If none of the answers is satisfactory, please edit your question to include an explanation of the security/login strategy you're using.

这篇关于如何在MS Access表单中获取我当前的用户登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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