登录表格 [英] Login Forms

查看:72
本文介绍了登录表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,


我会提到我在Access的每个意义上都是初学者。我为员工的所有培训记录创建了一个数据库。我已经设置了一个登录表单,需要一个链接到employee表的密码。


我的问题是如何创建一个命令按钮或操作,提示登录用户并让他们在登录后更改密码或从drop中选择用户名
提前感谢您的帮助!

Hello,

I will mention that I am a beginner at Access in every sense of the word. I have created a database for all the training records of my employees. I have set up a login form that requires a password linked to the employee table.

My question is how do I create a command button or action that will prompt the login user and enable them to change their password once they have logged in or chosen a user name from the drop down.

Thank you in advance for the help!

推荐答案

假设您的密码设置为默认值,例如密码。


您不能说是自由输入用户名还是从下拉列表中选择。我假设它是自由输入的(本例中为txtUser)。


在输入密码的文本框中(本示例为txtPassword)使用后续创建After Update事件以下代码。

Assuming your password is set to a default like "Password".

You don''t say if the username is entered freely or chosen from a dropdown list. I''m assuming it''s entered freely (txtUser for this example).

In the textbox where the password is entered (txtPassword for this example) create an After Update event using the following code.

展开 | 选择 | Wrap | 行号


感谢您的回复。我已经尝试了代码,修改它以匹配我的数据,我似乎无法让它工作。


用户名是从名为Combo10的下拉列表中选择的。我的密码输入文本框名为Text12。


我会附上我修改过的代码版本,这样你就可以看出它有什么问题。


我一直收到语法错误使用DLookup函数的行,我忘记在第一条消息中提到我正在使用Access 2003.


此代码也可以附加到命令按钮的OnClick事件上我用来验证密码并输入记录表格?


感谢您的帮助。


这是我的代码:

Thank you for your response. I have tried the code, modifying it to match my data and I can''t seem to get it to work.

The username is chosen from a dropdown list named Combo10. My textbox for the password entry is named Text12.

I will attach my modified version of the code so you can see what is wrong with it.

I keep getting a syntax error for the line with the DLookup function, as well I forgot to mention in my first message I am using Access 2003.

Also can this code be attached to the OnClick event of the command button that I am using to verify the password and enter the record form?

Thank you for the help.

Here is my code:

展开 | 选择 | Wrap | 行号



此代码也可以附加到我用来验证密码并输入记录表格的命令按钮的OnClick事件上吗?
Also can this code be attached to the OnClick event of the command button that I am using to verify the password and enter the record form?



是的可以。

Yes it can.



pswd = DLookup(" [strEmpPassword]"," strEmployees"," [IngEmpID] =''"& Me.Combo10。&"'')"

pswd = DLookup("[strEmpPassword]", "strEmployees", "[IngEmpID]=''" & Me.Combo10. & "'')"



首先,你在combo10之后有一个点,所以删除它。

其次,如果[lngEmpID]中的值是一个数字(I怀疑是)然后删除单引号如下。它们仅在比较字符串时才需要。


pswd = DLookup(" [strEmpPassword]"," strEmployees"," [IngEmpID] ="& Me.Combo10 &")"

Firstly, you have a dot after combo10 so remove it.
Secondly, if the value in [lngEmpID] is a number (I suspect it is) then remove single quotes as follows. They are only required when comparing strings.

pswd = DLookup("[strEmpPassword]", "strEmployees", "[IngEmpID]=" & Me.Combo10 & ")"


这篇关于登录表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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