Admin Privileges

B

Bolstaf

If a form has VBA code attached it seems that VBA wants to run as Admin
instead of the current logged in user. I had to grant Admin some
permissions on a secure DB and that then allows users to bypass the security.

I tried changing the VBA to connect using a specific user/password but that
just generates an error telling me the workgroup file is locked by another
user and not accessible.

Any suggestions?
 
B

Bolstaf

The Form imports and unpacks text from an email in Outlook and creates
records in a batch table. The the users can choose one of several buttons to
process the batch file against a master table.

I have the following VBA in the Form__Load function:

cnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=R:\CHANGE
MANAGEMENT\Databases\Tickets.mdb"
Set cnn = New ADODB.Connection
Set rsBatch = New ADODB.Recordset
Set rsTickets = New ADODB.Recordset
cnn.Open cnString
rsBatch.Open "UpdateBatch", cnn, adOpenDynamic, adLockOptimistic
rsTickets.Open "Tickets", cnn, adOpenDynamic, adLockOptimistic

The code fails on the cnn.open statement with "You do not have the necessary
permissons to access the database" unless I grant the admin user permissions
for the DB and tables/queries.

I added User and Password to the Open but then it tells me it cannot access
the workgroup file.
 
J

Joan Wild

You shouldn't need to add them to the Admins Group. Just grant them open
permisson on the database object.

You likely could accomplish this using linked tables in the frontend; then
your code wouldn't need to open a connection to the Tickets.mdb. Just carry
out the update using queries in the frontend.
 
B

Bolstaf

Sorry, I am confused.......

Who/What do you mean by "them" in this context? I have not added anyone to
the Admins group, but I did have to grant Admin itself much wider
permissions, this was the only way I could get the VBA code in a Form to open
a connection to the mdb.
 
J

Joan Wild

'Them' being your users. Grant your 'users' group (whatever group you
created for your users, not the Users Group) open permission on the mdb.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top