根据登录人员自动填充字段。 [英] Autopopulate a field based on logged in person.

查看:70
本文介绍了根据登录人员自动填充字段。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有自定义登录界面。当用户登录时,我希望显示类似欢迎John Doe的内容。在我的总机表格上?怎么做?请提示!!

此外,当用户选择打开数据输入表单时,名为ModUserID的字段应该填入现在登录的人员。

打开数据输入表单:frmOpendataentry是绑定表单。它绑定的表是tblRadioDataEntry。


谢谢


PS:我试图定义默认值表格和/或表格上的财产。这是行不通的。当我打开表单时,它会说#Name在ModUserID字段中。

解决方案

你可以在这里使用代码[ http://www.mvps.org/access/api/api0008.htm ]获取用户的登录名。您可能希望为用户提供登录名,实际名称和其他信息的表。


您需要创建一个包含每个用户的真实姓名,用户名,用户将使用他们的用户名登录数据库,然后您将使用用户名从用户表中提取真实姓名。


如果您使用Access 2003或更早版本设置用户级安全性,您可以通过CurrentUser()函数获取其用户名。如果您没有使用用户级安全性(这是更好的选择)并且您没有设置任何其他安全登录机制(您确实需要),您可以使用ENVIRON()从Windows获取用户名功能。检查此线程以获取更多安全性和ENVIRON()函数 http://bytes.com/topic/access/answer...assword-access


此处可能还存在术语问题。


通过自定义登录界面是指用户输入用户名和密码的实际登录表单,还是指定制的交换机?


您说当用户打开表单时,会出现一个名为ModUserID的字段应填写他们的名字。你的意思是窗体或实际表格字段上的控件吗?


最后,你想要将控件的默认值设置为什么?

好​​的,我想我现在已经完成了问题。如果我是你,我就会这样做。


数据库中有下表:

展开 | 选择 | Wrap | 行号< /跨度>

I have custom login interface. When the user logs in I want to show something like "Welcome John Doe" on my switchboard form? How to do it? Hint please!!
Also, when the user selects "Open data entry form", the field called ModUserID should be populated with the person who is logged in right now.
Open Data Entry form : frmOpendataentry is bound form. the table it is bound to is tblRadioDataEntry.

Thanks

PS: I tried to define "Default value" property on both table and/or form. It does not work. When I open the form it sayes "#Name" in ModUserID field.

解决方案

You can use the code here [http://www.mvps.org/access/api/api0008.htm] to get the login name of the user. You will likely want to have a table of login names, actual names, and other info for users.


You need to create a table that has each user''s real name, username, etc. The user will log into the database using their username, then you will use the username to pull the real name from your users table.

If you are using Access 2003 or earlier with User-Level Security set up, you can get their username via the CurrentUser() function. If you are not using User-Level Security (which is really the better option) and you don''t have any other secure login mechanism set up (which you really need), you can get the username from Windows using the ENVIRON() function. Check this thread for more on security and the ENVIRON() function http://bytes.com/topic/access/answer...assword-access.


There may also be a problem here with terminology.

By "custom login interface" do you mean an actual login form where the user enters a username and password, or do you mean a customized switchboard?

You say that when the user opens a form, a field called ModUserID should be populated with their name. Do you mean a control on the form or an actual table field?

And finally, what are you trying to set the default value of your control to?

Okay, I think I''m done with questions for now. This is what I''d do if I were you.

In the database is the following table:

Expand|Select|Wrap|Line Numbers


这篇关于根据登录人员自动填充字段。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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