Manage Users and permissions Access 2010

colkas

Registered User.
Local time
Today, 01:00
Joined
Apr 12, 2011
Messages
128
Hi All

Does anyone have any ideas on this at all

I have tried using the access 2010 manage user and passwords and I cant get this working. I use the Wizard but then when I go into the database it just shows as Admin as current user and does not even list the users I have so I am totally lost on this one.... Basically I want

1. A log in screen so user puts in username and password (I also need to log Job Title so I assume a tble is the way)
2. Then when logged in they are the current user, not the admin.

If anyone also knows any good documentation on how to sue the manage users and passwords part of access 2010 I would appreciate that.

I am not up on coding so the easier solution the better.

Many thanks
 
Re: Manage Users and permissions Acces 2010

If I understand you correctly you want to create a login form where users must enter a username and password before accessing the DB?

If so, have a look here :

http://www.databasedev.co.uk/login.html

There's an example file which you can download. I haven't tried the AC2010 wizard but I find the guide I've posted pretty good.

In AC2010 you can set the db to load the login form when users open the db.
 
Re: Manage Users and permissions Acces 2010

Seconding Jonathanchye. I've used his code (thanks, Johnathan); it's simple to understand and works a treat.
 
Hi

Thanks for the reply. That is something I am after except the databse needs to know who is logged in.

I logged in as Graham so the assumption is I am logged in as Graham.

If I add a text box and set the Contol Source =currentuser it comes back with the Admin username and not Graham as you would expect.

I need the solution to show the person who is logged in.... maily for reporting reasons so i can add into reports who the user was when the report was ran....

Any ideas...

Thanksw
 
So you want to log user logins? This can be done via VBA code or could be done if you modify the example. Create a new table called user logins. Set this table as your recordsource.

So if user press login first it will run the checks as given by the example if successful then it will create a new record and save it. You can easily save the current time and date too.

If I am not mistaken the example given should cover this. You will need to know some VBA coding and understanding though and not just rely on wizards. I'm on holiday now but if you post your code I'll try to help.
 
Hi jonathan

Yes I would like whoever is logged in to be the user =currentuser()

When we create a Quote report, I want the current user and their job title to display on the front cover and need this to happen as automatic as possible. So using login's is the only way I can think of.

So if I understand you correct, we use the DB in the example, but change the recordsouce of the form to look at the new table User Logins. Then change any relavant code.... (I am not to up on code so please excuse my ignorance here) to look at the correct table and field names.

I would like to have the date they are logged in (and maybe in the future link this to when a record as been changed or added)

So firstly am I correct in the understanding of the process to start the changes?

Thanks and hope you are enjoying your holiday.
 
It depends in what you plan to use user logins for. What I did for mine is the default the db to open the login form everytime the user opens the db. If they login successfully I used VBA code to store their login details to a related table. You would need to build relevant tables though. I have one table for username and passwords and another related table to log their logins.

If you just want to print username on reports you can use queries on the reports On Load event and further use Auto Date and auto time for time and date report printed.
 
HI

thanks DCrake for your reply and link. I took a look at this but found it a little to complex for my limited knowledge and would find it har to implement into our DB.

Jonathan - I think what you have is more or less what I am after. If it logs the current user into another table I can link this to the report query and then add the name and title in. So If I use the databse example as per the other comments... is it possbile for you to let me know the code and how to insert it..... I will try it in the example and then apply to the real DB

Many thanks
 
I'm on hOliday now so only have iPhone to check forums :)
I will post code up when I can if you still need it by then.
 
Ok Jonanthan when you can of course, its appreciated and enjoy your Holiday

Thanks
 
Hi Dcrake

I just downloaded the DB and taken a more detailed look. It does as some good features, especially the who is logged in and date etc...... so I would like to adapt this and see if it would work within our db.... but first

1. I have logged in as Delilah with password Del and it is showing this user as logged in now with todays date. However if I do currentuser() it still returns Admin.

So if I was Delilah and was entering a quote for example, how can i show she is the user adding the quote.

2. I also want to include on front of reports like a quote, the username and job position of the person logged in and creating the report....

So firstly what is the best table to add in Job postion field and how can we see who is creating the quote and have it appear on the report..

3. I also need it to display the form when you first open the DB so they have to log in first .

So they are my worries or not sure how to's and of course I need to place this in my exisitin databse, so abit worried I may need to change coding.

Thanks
 
There are different types of users to consider

1. Windows user - Who is logged into the machine
2. Application user - Who is logged in to the application (Delilah)
3. Access user - Always admin if User Defined Security is not employed.

There is a API function Called GetCurrentUser() This is windows user
There is a similar one for GetComputerName() self explanitory

In your tables that you want to have traceability you would add extra fields depending on how much depth you want to employ

CreatedDateTime - Date record was created - Default Value of Now()
CreatedBy - Application User (2)
ComputerName - optional
WindowsUser - Optional - User A could log into machine - but user B could load application if permissions allow this.

LastUpDatedDateTime - Now()
LastUpdatedBy - Application User (2)
ComputerName - optional
WindowsUser - Optional - User A could log into machine - but user B could load application if permissions allow this.

If you create Public variables in a stadard module you can pass user names to these variables and use them in reports etc to show who did what.
 
Hi

Thanks for the reply.

How do I see who is logged into the application, to see the currentuser I have just created a form with unbound control with the source being =currentuser(), which shows admin.

Thanks
 
Sorry forgot, also how do I make the new field Craeted by see the application user name..

And again sorry I do not understand what you mean by variables to pass the info to the reports

Thanks
 
Create a standard module and define a public variable called StrUserName

Module Name:ModPublics

Public StrUserName As String


When the user logs in via the login form store the user name from the combo box and pass it to the variable

CboUser AfterUpdate

StrUserName = Me.CboUser

Then on your main form or any form you want to display the current user name place a label on the screen and code

Me.LblUserName.Caption = StrUserName


This will then display Deliliah on the form.

Remember to use the actual field names above is for brevity only.
 
I am going to point you to another Sample database that uses puplic variables, this may give you more insight into what I am referring to.
 
The database example already as code on the afterupdate in the form Frmlogin. How do I do this in the example databse??

Thanks
 
Extract form FrmLogin

Code:
Private Sub CboUser_AfterUpdate()
'/Enable the login button
If Trim(Me.CboUser & "") <> "" Then
    Me.CmdLogin.Enabled = True
    '/Get the users permissions for RBAC
[B]    
    StrUserName = FindUserName()
    StrLoginName = Me.CboUser
    StrComputerName = FindComputerName()[/B]    
LngUserID = Me.CboUser.Column(0)
    StrPassword = DecryptKey(Me.CboUser.Column(4))
    blnChangeOwnPassword = Me.CboUser.Column(5)
    intPasswordExpireDays = Me.CboUser.Column(6)
    intAccessLevel = Me.CboUser.Column(7)
    
    
End If

StrUserName is the Windoes login name
StrLoginName = Delilah
StrComputerName = computer name

Use these public variables to display on on other forms
 

Users who are viewing this thread

Back
Top Bottom