Using Logins to populate tables/forms

Charlottew14

Registered User.
Local time
Today, 14:36
Joined
Oct 4, 2012
Messages
32
Hi,

I'm a total novice when it comes to using Access, but I'm making slow progress!
I'm using 2010 and have created a database with two main functions - one is to add records and the other is to view records.

There are 5 users adding records, and at the moment they all use one login, and then select their name from the list when adding a record.

Ideally, I'd like everyone to have their own login details, and then Access could automatically put their name to that record.

Is this even possible?!?

Like I said, I'm only at a basic level so I'm not sure about using VBL but I'm okay using macros. Thanks :)
 
Yes it is totally possible, what you need is

A table with their login names, password..

Create a Form that will have two text boxes and a button..

One accepts username and the other one takes password (so technically has an input mask of password).. on the button click use a DLookUp to see if UserName matches the Password if it does grant access and make the form invisible do not close it, so when you want to use the User name use Forms!LoginForm!UserName
 
Brilliant, thank you!

I THINK I've got it working, but no matter what I try, the name to select always appears in a combo box, rather than being automatically added. Is there anyway to stop this?

Thanks again helping, I think I'd be here all day otherwise!
 
What do you mean when you say "automatically added"?? Employee names are normally placed in ComboBox so it will be easier to change or all available agent names.. if that makes sense..
 
I think I've solved it by making the default value the username from the invisible login screen.

Thank you for you help!!
 
Could you please help. I am in the need of the same code. I have a login form with username, password and the table has the empnumber which is not displayed on the login form.

When the user login successfull I want the form collection to open records that matches only that empnumber. Please help.
 
Hello mcsrta.. Welcome to AWF.. If you have a specific query, best to put it in a separate thread.. Having said that, how is your form designed? Are you using TextBox for obtaining username? or are you using ComboBox? Because code needs to change as per the design.

Regarding your second part, do you in your table (employee) have a field that describes the levels/available forms for each employee? A bit more information could help us go around. I just put together a simple demo.. not great, but should give you the basic idea.. try to adapt it to your code.. if you find it hard to follow.. post back..
 

Attachments

pr2-eugin thank you so much for your reply. Right now I am using text box but rather use combo box.

Yes in the employee table there is an acccess level field.

When the user login I want them to open the checks form because they can only add notes. When they login I want them to be able to see their empnumber records only, no other employee records.

When admin and tech person login I want the checks admin form to open with all records available.

The simple demo is great and will work for me if I can get it to only to display the correct records for the assigned employee.

I have attached a copy of my database. Thank you so much.
 

Attachments

Pr2-eugin I did put my question in a separate thread,
Login Form that brings back certain records according to the user login.
Can you please help. I am desperate. Thank you.
 
Hello mcsrta.. Welcome to AWF.. If you have a specific query, best to put it in a separate thread.. Having said that, how is your form designed? Are you using TextBox for obtaining username? or are you using ComboBox? Because code needs to change as per the design.

Regarding your second part, do you in your table (employee) have a field that describes the levels/available forms for each employee? A bit more information could help us go around. I just put together a simple demo.. not great, but should give you the basic idea.. try to adapt it to your code.. if you find it hard to follow.. post back..


Pr2-eugin I did put my question in a separate thread,
Login Form that brings back certain records according to the user login.
Can you please help. I am desperate. Thank you.
 
Hello mcsrta.. Welcome to AWF.. If you have a specific query, best to put it in a separate thread.. Having said that, how is your form designed? Are you using TextBox for obtaining username? or are you using ComboBox? Because code needs to change as per the design.

Regarding your second part, do you in your table (employee) have a field that describes the levels/available forms for each employee? A bit more information could help us go around. I just put together a simple demo.. not great, but should give you the basic idea.. try to adapt it to your code.. if you find it hard to follow.. post back..
.............................................................................................
The sample you sent me all the users access the same form after logged in and me i want two user each to access his form different from each other.


I have used Combo box. security_level field is the one that describes their levels and there are only two levels 1 and 2... My design is like this …. Below…
I have a table called User (user_ID, User_Name, Password, Security_Level)
On form there is a combo box for user name and text box for password.
Two command button where one is for EXIT (Closing the application) and the second button is to run the code.

if the password in table User matches value chosen in combo box or user name and password are correct
Then it should check if Security_Level of the user is equal to 1 to displays a form called Admin
and when the Security_Level of the user is equal to 2 to display a form called user1.

NOTE: All that I want is to have a login that has two user and each user when login opens his/her own form which is different from the other user.
 
I have used Combo box. security_level field is the one that describes their levels and there are only two levels 1 and 2... My design is like this …. Below…
I have a table called User (user_ID, User_Name, Password, Security_Level)
On form there is a combo box for user name and text box for password.
Two command button where one is for EXIT (Closing the application) and the second button is to run the code.

if the password in table User matches value chosen in combo box or user name and password are correct
Then it should check if Security_Level of the user is equal to 1 to displays a form called Admin
and when the Security_Level of the user is equal to 2 to display a form called user1.

NOTE: All that I want is to have a login that has two user and each user when login opens his/her own form which is different from the other user.
 
Then it should check if Security_Level of the user is equal to 1 to displays a form called Admin
and when the Security_Level of the user is equal to 2 to display a form called user1.
Hello chriss_ko, if you have noticed the code, after Authentication you will have something like..
Code:
DoCmd.OpenForm "formName"
Now all you need to do it add another DLookUp to get the Security Level..
Code:
Dim accessLvlStr As String
accessLvlStr = Nz(DLookUp("[COLOR=Blue]securityLevelField[/COLOR]","[COLOR=Blue]tableName[/COLOR]","[COLOR=Blue]ConditionToCheck[/COLOR]"), "Admin")
If accessLvlStr = "Admin"
    DoCmd.OpenForm "AdminForm"
Else
    DoCmd.OpenForm "UserForm"
End If
The above is just a psuedo code.. Change the blue bits to match your design.. Hope this helps..
 
Hey, sory again how do i write the
"ConditionToCheck"

if I have a table called User (user_ID, User_Name, Password, Security_Level)
 
Chriss_ko, I am not going to respond to this thread.. As I am already helping you here.. Please do not update anything here..
 

Users who are viewing this thread

Back
Top Bottom