Public Sub loginbtn_Click()

  If IsNull([usernamecbo]) = True Then
        MsgBox "Username is required", vbOKOnly, "Required Data"
    ElseIf IsNull([passwordtxt]) = True Then
        MsgBox "Password is required", vbOKOnly, "Required Data"
    If Me.passwordtxt.Value = DLookup("PASSWORD", "SYS_USER", "[SERIAL_NUMBER] = " & Me.usernamecbo.Value) Then
            strUser = Me.usernamecbo.Value
            strAccountType = DLookup("USER_TYPE", "SYS_USER", "[SERIAL_NUMBER] = " & Me.usernamecbo.Value)
            MsgBox "Welcome Back, " & strAccountType, vbOKOnly, "Welcome"
            DoCmd.OpenForm "First Screen"
            MsgBox "Invalid Password. Please try again.", vbOKOnly, "Invalid Password"
        End If
    End If

End Sub

This is a Code That Search in data base for related records to be able to log in to system and it all works great.
the question is, if i want to make the user can modify his password, how can this be done.
thanks in advance :)

I am not sure that it makes sense for a user to be able to change their password from a login screen. It would normally be a function that the user can access after they have logged on.

Once the user is properly logged on, then you can present them the option to change their password.

commented: agree +13

yes, thats what i`m asking for, i think i should create a form that allow modification, but the problem is that i want the user when he enters that page, he should only be allowed to change his information, how can i allow the form to only view his information not his and other users information.

hi all,
i have completed a data base with access 2007, i have a table "SYS_USER" which holds users (first name, last name, username, password, account type).
i created a form to allow adding users.
now what i need is to allow users to edit their information.
only their information, the problem is when the user login to the system and go to the modify user account page, he can navigate in this page for all users account not his account only, how can i perform that.

you need to create 2 types of users
1. admin user -- can access any user details
2. restricted user -- can access self data only.

when the restricted operates all the data s/he has access to is own records only(filter by user name or id what ever you are maintaining in your database).

thanks for reply,
i already have a field in the database (accounttype) its a lookup having three attributes, (ADMIN, MANAGER, Agent).
But how can i allow the form the only view the record of the agent or the manager, is it by using the filter property in the form properties.
i tried filter by username, but when i logged in with the manager acount, the form viewed all records.
HINT: defined a global variable as struser, straccounttype.

as i have already mentioned you need to filer the records from database as per user roles / user type.

Threads merged. Please do not create multiple threads for a single question.