Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using ADO, Connect to backend db using frontends mdw 1

Status
Not open for further replies.

dlgtwice

Programmer
Aug 19, 2003
17
US
Hi All,

I'm coding with ADO and have run into a problem. Does anyone anyone know of a way to connect to a backend database using the frontend databases currently open security connection? I can connect fine using my Admin user id and password but I was hoping to use the currently logged in users permissions rather than my own.

Thanks!
 
dlgtwice

CurrentUser function reveals the user acccount logged on.
There is no such function for the corresponding password.
So, if you have passworded for viewing, the project properties, use your own. Better more, create a dummy user with the appropriate rights to connect and do the work instead. Of course no one else should be aware of that dummy UserID and Password.
 
JerryKlmns,

Thanks for the speedy response and info.

I was able to use my own cridentials but then everyone would have admin rights. So, I was thinking about trying to build a dummy user but I'm not sure how to get the current users rights or group. Is there a function to extract that information?

Thanks,
 
>I was able to use my own cridentials but then everyone would have admin rights

No! Just your connection. And all the actions made are controled by your code.

>how to get the current users rights or group
You said you are the Admin!
 
My trouble with leaving the admin connection is that there are several levels of users that will be using these forms and not all have admin rights.

To your second response, I am the admin, but I need to check it programmatically so as to create the dummy user with the same rights.

Sorry if I'm a little dense on this. I haven't had my Mountain Dew yet!

Per your suggestion above:

*I'd like to extract the user rights programmatically.
*Create the dummy user with the same rights.
*Make the connection using the dummy user.
*Then, destroy the dummy user.

Am I on the right track?
 
dlgtwice

You are saying to create and drop the user on the fly? No. I meant create him once and leave it there! Just give him the rights to update and delete on the tables you need and keep the [strong] password in your head.

And why don't you give them the rights on tables in advance? They are linked tables aren't they?

----------------------
A proper connection to the .mdw database file and the following SQL statement should get the groups that the user belongs.

"SELECT DISTINCT MSysAccounts_1.Name FROM (MSysAccounts INNER JOIN MSysGroups ON MSysAccounts.SID = MSysGroups.UserSID) INNER JOIN MSysAccounts AS MSysAccounts_1 ON MSysGroups.GroupSID = MSysAccounts_1.SID WHERE MSysAccounts.name = '" & CuerrentUser & "' and MSysAccounts.FGroup = 0 and MSysAccounts_1.FGroup <> 0;"

----------------------
And keep your users away from design of forms, modules. Create a start up form, don't let me use the shifht key at start up, password protect the project etc.

 
Thanks for the advice JerryKlmns.

[thumbsup2]I'll work on the implemention this weekend and see how it goes.

Appreciate it!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top