chuck said:
I have an Access ADP project which uses "Windows NT Integrated Security" to
connect to the SQL server. On occasion, me or some of my users may be
logged on to Windows with an account that does not have access to the SQL
database. Can I add code to Access that will prompt me for another set of
Windows credentials to logon to the database ?
thanks
chuck,
The following may, or may not, work.
You will have to open up your Visual Basic Editor (Tools > Macro > Visual Basic Editor).
In the VBE, you will have to open up the References dialog box, (Tools > References).
Scroll down until you locate the SQL-DMO reference. Check it and click ok. If it is not
there, you can't do this.
Once checked, open up SQL Server's Books Online and read up on SQL-DMO.
Look up the Login, User, and ServerRole objects and their associated collections.
-----------------
For Example (from BOL, Login Object):
- To add a login to a server running SQL Server
1 - Create a Login object.
2 - Set the Name property.
3 - Set the Type property. By default, a login is created for use by SQL Server
Authentication. Alternately specify the login type to map a Microsoft Windows NT® user or
group.
4 - Add the Login object to the Logins collection of a connected SQLServer object to
create the SQL Server login.
Note To view, create, or remove SQL Server logins by using the Login object, the connected
user must be a member of the SQL Server securityadmin fixed server role.
-----------------
That last requirement, securityadmin privileges, may be a problem.
I've never tried doing this, and so as noted above, I can't say how it will work out for
you.
Sincerely,
Chris O.