1. When logging on to the system, You need to log on to the user ID and password. If the user exists, the logon is successful.
You can only add a user as an administrator, so you can only log on to the system as an administrator.
When a user is added, there is an account owner, which can be obtained from the user_info table.
What we need to do now is to obtain the account owner. Because the account owner can only be the administrator, that is, the account owner who adds the user is the administrator who logs on to the system.
Based on the user ID of the logon form, we can find the username in user_info, that is, the account owner.
The following code is used for implementation:
Txtsql = "select * From user_info where userid = '" & trim(frmlogin.txt userid. Text )&"'"
Set MRCC = executesql (txtsql, msgtext)
Txtkaiuser. Text = trim (MRCC. Fields (2 ))
2
.
In the data setting table, the account owner is also used to log on to the form to retrieve data.
3. Data is also retrieved from the user_info database by using the "user ID" at logon.
'Here, the reason why the user is retrieved from the database is that the username in the frmlogin login form is changed to userid because username cannot uniquely identify a user.
Txtsql = "select * From user_info where userid = '" & trim(frmlogin.txt userid. Text )&"'"
Set MRC = executesql (txtsql, msgtext)
If MRC. EOF = false and trim (MRC. Fields (1) = "general user" then
Operator. Enabled = false
Admin. Enabled = false
End if
'The functions that the operator can achieve (can perform operations by ordinary users and operators)
If MRC. EOF = false and trim (MRC. Fields (1) = "operator" then
Admin. Enabled = false
End if
End sub
'In another situation, the administrator can perform operations