Change User Permissions thru Code

G

Geoff

I am having a problem with the user and group permissions
in an access 2000 database. The rights are set up so that
the users cannot view or make any design changes. One of
the forms has a subform that changes depending on what
product was selected. When a user attempts to open this
form, they receive an error stating that they do not have
permission to insert another object into a form. I was
wondering how I could change the permissions in vb to
allow the user to insert the subform and then change it
back.
Thnak you in advance for any help you can offer.
Geoff
 
J

Joan Wild

Rather than inserting a subform, you could (depending on the circumstances)

a) change the recordsource for the subform
or
b) create multiple subforms, and set the visibility of the subform controls
depending on the product selected.
 
G

Guest

Changing the record souce is not an option because the
products contain many different fields. I thought about
putting each subform in the form and changing the
visibility, but I figured there had to be a better way. I
saw something called SetPermissions, but I can't get the
code to compile. The error message is "Cant find project
or library". It stops on adPermObjProviderSpecific. I
pretty sure I have all of the necessary references
checked. Below is the code I am using.

Dim Cat As New ADOX.Catalog
Dim lngPermissions As Long

Cat.ActiveConnection = CurrentProject.Connection

(This is all one line)
lngPermissions = Cat.Groups("Users").SetPermissions
("frmForm", adPermObjProviderSpecific, adAccessGrant,
adRightFull, adInheritBoth, Form)
 

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