473,387 Members | 1,541 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Add users to security file from a form

beacon
579 512MB
Hi everybody,

I have a database that I intend on setting up user/group permissions for using the built-in security wizard, but I don't want to have to manage adding every user since the database is primarily used by a different department at my company.

I will still end up being the administrator for the database, but I want the users to be able to add new users and assign their permissions, which will be the same for all users, using a form so they won't have to access the security file.

Is this possible?

Thanks,
beacon
Jul 21 '10 #1

✓ answered by munkee

For some reason I couldnt get the sql working when I gave it a go last night although I'm sure this was working for me a couple of years ago.

Your 3 options on controlling the security via vba can be found here:

http://msdn.microsoft.com/en-us/libr...ice.10%29.aspx

more direct for using ado which looks quite simple.

http://msdn.microsoft.com/en-us/libr...ffice.10).aspx


I will look in to further why the sql isnt working and post back as it was really easy to utilise in the past.


Edit:


Cracked it I forgot you had to use ADO to be able to use Jet 4 sql commands. Just create the string adding in any elements needed from your form.

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdClick()
  2. Dim conDatabase As ADODB.Connection
  3. Dim SQL As String
  4.  
  5. On Error GoTo ErrorsofMassDEATH
  6.  
  7. Set conDatabase = Application.CurrentProject.Connection
  8. SQL = "CREATE USER user1 password1 pid1"
  9. conDatabase.Execute SQL
  10.  
  11. conDatabase.Close
  12. Set conDatabase = Nothing
  13.  
  14. Exit Sub
  15. ErrorsofMassDEATH
  16.    MsgBox Err.Description, vbInformation
  17. Exit Sub
  18. End Sub
  19.  

3 1539
munkee
374 256MB
This is very much possible beacon, to be honest I have found creating my own security system much easier than using asccess built in security.

However with that being you can use SQL to add users / permissions / groups etc.

You will need to simply tie the following sql procedures to execute within unbound forms.

To create an account sql is

CREATE USER user1 password1 pid1 [, user2 password2 pid2 [, etcetcetc] ]

to create a new group

CREATE GROUP group1 pid1 [, group2 pid2 [, etcetcetc] ]

To change a password you can use

ALTER USER user PASSWORD newpassword oldpassword

To add a user to a group you can use

ADD USER user1 [, user2 [, etcetcetc ]] TO group

To remove a user you can use

DROP USER user1 , [, user2 [, etcetcetc ]] FROM group

To add them a priveladge you can use

GRANT privilege1 [, privilege2 [, etcetcetc ] ] ON {TABLE table1 | OBJECT object1 | CONTAINER container1} TO account1 [, account2 [, etcetcetc]]

Where you select a priveledge clause within the {} brackets above

All of the above referenced from access 2002 desktop developers handbook chapter 5 incase you have it and want some more detail.
Jul 24 '10 #2
beacon
579 512MB
@munkee
Honestly, I prefer to set up my own security too, but this is a database for a different department that needs something setup quickly and due to demands on my time, I really can't afford to create all of the security for them in the timeframe that they need it.

Just so I'm clear, I can add the SQL to a form in the main database and it will update the security file? I'm assuming that a link is created between the main database and the security file when the security file is created and that I won't have to reference that link if I use the SQL you provided in one of my forms...is that right?
Jul 24 '10 #3
munkee
374 256MB
For some reason I couldnt get the sql working when I gave it a go last night although I'm sure this was working for me a couple of years ago.

Your 3 options on controlling the security via vba can be found here:

http://msdn.microsoft.com/en-us/libr...ice.10%29.aspx

more direct for using ado which looks quite simple.

http://msdn.microsoft.com/en-us/libr...ffice.10).aspx


I will look in to further why the sql isnt working and post back as it was really easy to utilise in the past.


Edit:


Cracked it I forgot you had to use ADO to be able to use Jet 4 sql commands. Just create the string adding in any elements needed from your form.

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdClick()
  2. Dim conDatabase As ADODB.Connection
  3. Dim SQL As String
  4.  
  5. On Error GoTo ErrorsofMassDEATH
  6.  
  7. Set conDatabase = Application.CurrentProject.Connection
  8. SQL = "CREATE USER user1 password1 pid1"
  9. conDatabase.Execute SQL
  10.  
  11. conDatabase.Close
  12. Set conDatabase = Nothing
  13.  
  14. Exit Sub
  15. ErrorsofMassDEATH
  16.    MsgBox Err.Description, vbInformation
  17. Exit Sub
  18. End Sub
  19.  
Jul 25 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Richard | last post by:
I have a client who needs to upload the same 7 files twice a week to his web server. FTP is unfortunately not an option as the client is a novice, so I have created an admin interface to his...
23
by: Lamberti Fabrizio | last post by:
Hi all, I've to access to a network file from an asp pages. I've red a lot of things on old posts and on Microsoft article but I can't still solve my problem. I've got two server inside the...
1
by: PrisNo6 | last post by:
I have some old code locked in two Access 97 files where I lost the mdw file and the pid do to system crashes. Can someone refer me to a commercial vendor who can crack these files? - Regards -...
4
by: Michael | last post by:
Hi, I have an Access database set up on a network drive that several users can access. The database has many queries but just one main form. I have designed a startup form where a user can...
2
by: None | last post by:
Hi, I have one Listbox and Two buttons one is Add and Other is Remove. When i click the add button i want to show the Select Users or Groups Form(i.e, When you right click any file or folder and...
2
by: pv | last post by:
Hi everyone, I need help with following scenario, please: Users are accessing same web server from intranet (users previously authenticated in Active Dir) and from extranet (common public...
1
by: Amjad | last post by:
Hi, I have installed a VB.NET application on a Windows 2000 computer. The application writes to the hard disk under the its folder and writes to the Registry under "LocalMachine\Software". I...
12
by: Mesan | last post by:
I have a directory in an app I'm building that has access limited to users within a specific role and all aspx pages in that directory are unavailable just as I'd hope but other files (pdfs and...
4
by: rn5a | last post by:
I am storing the physical path of images, along with 3 more columns, in a MS-Access DB table. I want to provide users the option to change this physical image path (as well as the records in the...
2
by: Alex Lirus | last post by:
Hi. We are facing a problem with an old PHP application. The application browse the local server directory in order to show to the client browser file info and data. When we remove all the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.