Access 2010 and User Level Security to SQL back-end

I'm designing an Access 2010 front-end application that hooks to an SQL Express backend. The organization that I am designing this for does not want to manage separate logon ids and security levels within Access. They would prefer to set up Roles and Users within SQL and use Windows Authentication for the connection. Here's the question, is it possible through ADOX or some other library to obtain the current user's credentials upon the start-up of the front-end. Depending on who the user is and their role, the start-up module of the application (through VBA)  will determine what portions of the application are available for that use (i.e. Menus and Menu options).
KerryS1Asked:
Who is Participating?

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

x
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.

Boyd (HiTechCoach) Trimmell, Microsoft Access MVPDesigner and DeveloperCommented:
If you just need the Windows user name then you can use this API:

Get Login name
KerryS1Author Commented:
Actually what I need is to determine which Group (Role) on the SQL Server that the current user belongs to aka Readers, Writers, Admin, etc.
Boyd (HiTechCoach) Trimmell, Microsoft Access MVPDesigner and DeveloperCommented:
This might help:

Function GetSqlUser() As String

Dim qrd As DAO.QueryDef
Dim rst As DAO.Recordset

Set qrd = CurrentDb.CreateQueryDef("")
With qrd
     .Connect = CurrentDb.TableDefs(0).Connect
     .SQL = "SELECT SYSTEM_USER"
     .ReturnsRecords = True
End With

Set rst = qrd.OpenRecordset()

GetSqlUser = rst(0).Value

rst.Close

Set rst = Nothing
Set qrd = Nothing

End Function

Open in new window

10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

KerryS1Author Commented:
That code will return the ServerName\User but unfortunately it doesn't return what I need. This application is not allowed to contain individual user IDs so just returning the user name won't help in determining the user's role and security priviledges on the SQL server. What I need is to determine what priviledges the current user has access to. One option would be to do a test update on a table where only admins have full rights. If the update fails then I know the current user does not have admin priviledges. I was hoping there would be a simpler solution other than testing for error codes. For example, ADOX has a GetPermissions method. Does anyone know of a way to use the above suggested code that returns a user name in combination with the GetPermissions method to return that user's permissions? I could then test for adRightNone or adRightFull to determine which menus to display.
Boyd (HiTechCoach) Trimmell, Microsoft Access MVPDesigner and DeveloperCommented:
Boyd (HiTechCoach) Trimmell, Microsoft Access MVPDesigner and DeveloperCommented:
KerryS1Author Commented:
SELECT * FROM fn_mypermissions('lkpLoanType','object')

Returns permission_name and subentity_name but no User name.
Boyd (HiTechCoach) Trimmell, Microsoft Access MVPDesigner and DeveloperCommented:
AFAIK, you have to use both of them together. One for the user and the other to get that user's permissions.
KerryS1Author Commented:
The advice offered did not help solve my problem. I have since taken a less likeable solution which is to create multiple applications with limited functions and distribute those application to users based on their level of security.

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
KerryS1Author Commented:
Problem not solved.
Boyd (HiTechCoach) Trimmell, Microsoft Access MVPDesigner and DeveloperCommented:
I would recommend that you request the question be reopened.
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.