Microsoft Office Access - User does not have permission to perform this action

Hi all.

I have an Access 2003 ade file that has a form that creates logins for my Access form. I get the following error:

"User does not have permission to perform this action"

When it gets to this line of code in the VBA:

DoCmd.RunSQL "EXEC sp_grantlogin '" & WindowsID & "'"

Open in new window

WindowsID is a field on the form. I don't know why this is happening. The user has datareader and datawriter permissions in the database.

What is going on?

Thank you in advance.
Who is Participating?
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.

Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
The user login under which you're running that "sp_GrantLogin" command must be a member of the SQL Server  sysadmin or securityadmin group. You'd have to up the permissions of the user, or use a different login to connect to the server.

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
Sim1980Author Commented:
I've never had to do that. But I'll go ahead and do that and see.
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.