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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

User Level Security with runtime 1

Status
Not open for further replies.

jwhalen29

Programmer
Mar 12, 2002
15
US
Does a runtime user have the ability to change their password on a user-level secured database?
 
Only if you allow it when you create the mdw file.

AccessGuruCarl
Programmers helping programmers
you can't find a better site.
 
I don't remember that option in the wizard. Can I modify the mdw after it is created to allow runtime users to change their own password?
 
I'd have to re-test to be sure...

But, if you leave the password field blank when you create the user, they have the option of entering 1 when they first run it!

There's no message or anything that inform's the user of this, you need to inform them yourself. Only after entering a password, does it ask to confirm.

If you want them to have the ability to change it again...
Then you need to build a custom form, that links to the system table in the mdw file. And load it based on the user logged in. They can only change it after they log in!

If you can locate a copy of SAMS - Mastering Microsoft Access 2000 Development they have a sample of how to do this.

It's not as simple as just linking the table, and building a form! The mdw file was meant to prevent users from changing things.

If your really interested, I could post the code but I believe it's quite lenghty.... And would be difficult to understand whats going on without seeing the forms involved. Your local library should have a copy. - It's published by Alison Balter

Once you get a hold of all the code, their is an error in the book. Depending on what you try to do with the user.
If you come across it, and can't figure out what's going on drop another a post. I'll see if it's realted to the error I was getting.

Let me know how you make out.

AccessGuruCarl
Programmers helping programmers
you can't find a better site.
 
Ed2020

Great find!!! Code here is much more refined and 10 times better than what I saw in the development book




AccessGuruCarl
Programmers helping programmers
you can't find a better site.
 
Hello Ed2020

If been pretty helpful in past for me, Not sure if your familiar with VB6, But I have a a problem I posted in the VB forum, I'll bounce it off you, maybe I'll have better luck...

I have a db with a secured workgroup file. I'm trying to open the db and get the startup properties. But there seems to be a problem connecting to secured workgroups in VB.

Here is a link to the VB post...

Any ideas, would be greatly appreciated!



AccessGuruCarl
Programmers helping programmers
you can't find a better site.
 
Carl,

I have some additional code at work that demonstrates how to call the SQL to work with MS Access security. I've always found it a little strange that it's so much easier to do it this way than through DAO...

I've had a quick look over your other thread. It's 6:30am here, so I may have missed quite a lot! This may solve your problem:

Function to open a secured database:

Code:
Public Function OpenSecureDB(ByVal strDatabasePath As String, ByVal strMDW_Path As String, ByVal strUserName As String, ByVal strPassword As String) As DAO.Database
    Dim MyDBE As DAO.PrivDBEngine
    Dim wrkJet As DAO.Workspace

    Set MyDBE = New PrivDBEngine
    MyDBE.SystemDB = strMDW_Path
    MyDBE.DefaultUser = strUserName
    MyDBE.DefaultPassword = strPassword
    
    Set wrkJet = MyDBE.Workspaces(0)
    
    Set OpenSecureDB = wrkJet.OpenDatabase(strDatabasePath)
End Function

Sample call:

Code:
    Dim x As DAO.Database
    Set x = OpenSecureDB("C:\Documents and Settings\Ed Metcalfe\My Documents\db5.mdb", "C:\Documents and Settings\Ed Metcalfe\Application Data\Microsoft\Access\Tester.mdw", "Ed", "EdsPassword")

You can then work with "x" as you would do any other time.

Ed Metcalfe.

Please do not feed the trolls.....
 
Just re-read my previous post and that final sentence doesn't explain what I mean very well at all!

I meant to say:

You can then work with your opened secure database's properties ("X" in my example call) in the same way you would do if you were working with the CurrentDB() in Access VBA.

Ed Metcalfe.

Please do not feed the trolls.....
 
Hello Ed,

It failed at Set wrkJet = MyDBE.Workspaces(0)

Error 3028
Cannot start your application. The workgroup file is missing or opened exclusively by another user.

Which this seems to be the error I get whenever I have code that would normally work in Access

Do you know if I need any other references set other than the DAO 3.6 and the default VB references.


Thanks....

AccessGuruCarl
Programmers helping programmers
you can't find a better site.
 
Carl,

Strange, it's working fine on my PC. Check and recheck your MDW path is correct. Adding a line to the function to check for the existence of the MDW file (using Dir()) immediately after the declarations would be a good idea.

If you MDW filepath is definitely correct give this a try instead:

Code:
Public Function OpenSecureDB(ByVal strDatabasePath As String, ByVal strMDW_Path As String, ByVal strUserName As String, ByVal strPassword As String) As DAO.Database
    Dim MyDBE As DAO.PrivDBEngine

    Set MyDBE = New PrivDBEngine
    MyDBE.SystemDB = strMDW_Path
    MyDBE.DefaultUser = strUserName
    MyDBE.DefaultPassword = strPassword
       
    Set OpenSecureDB = MyDBE.OpenDatabase(strDatabasePath)
End Function

I can't really see how it will make any difference if I'm honest, but it's worth a try.

Failing that I can only assume that you have a problem with your DAO library. Do you have all updates installed?

Ed Metcalfe.

Please do not feed the trolls.....
 
Carl,

Missed your last question!

No, the only reference I have added is to the DAO3.6 Object Library. My final list is:

1. Visual Basic for Applications.
2. Visual Basic runtime objects and procedures.
3. OLE Automation.
4. Microsoft DAO3.6 Object Library.

Ed Metcalfe.

Please do not feed the trolls.....
 
You hit it right on the nose Ed....

I forgot to rem out your path....

Everything is working great....
I did modify it a bit, so I wasn't calling the function.
I was having trouble getting the properties.

But now that I now what I was doing wrong, I my revert back to the function so that I don't need to duplicate the code in the ChangeProperty Function!

I'll update my post in the VB forum once I have it finalized.
Thanks Again!!!


AccessGuruCarl
Programmers helping programmers
you can't find a better site.
 
Carl,

You're very welcome. :)

Ed Metcalfe.

Please do not feed the trolls.....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top