Logged in Details ( Ms Access application

I want all the forms to show the names or title of a person logged in the application , the same way my application is able to authorize the the forms to use as per user rights, below is my code for segregation of duties:

Private Sub Form_Open(Cancel As Integer)
Dim strITAccounts As String
Dim strITManager As String
strITManager = "Managers"
strITAccounts = "Finance"
If (Forms!frmLogin!txtUserrights.Value = [strITManager]) Then
Cancel = False
Exit Sub
ElseIf Forms!frmLogin!txtUserrights.Value <> [strITAccounts] Then
MsgBox "You are not authorized to open this form!", vbOKOnly + vbExclamation, "Rights Not Granted"
Cancel = True
Exit Sub
End If
End Sub

The above profile is for an accountant now all what I want to see in all forms is a title called accountant as per profile above.Any idea??????????

Hankwembo Christopher,FCCA,FZICA,CIA,MAAT,B.A.ScDirectorAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ste5anSenior DeveloperCommented:
Is it a plain Access application or do you use SQL Server as back-end?
Fabrice LambertFabrice LambertCommented:

Will updating the form's Caption property be enough ?
What form is running this code?  It looks like it is NOT frmLogin because otherwise you would refer to the form fields using Me. rather than the external Forms!yourform... style.

As long as the login form remains open but hidden, you can reference anything on it so you can add controls to the headers of your other forms that reference the fields from the login form that you want to display. for example:


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.