User changing password with code

D

Damien McBain

My DB is secured with a workgroup file. All the forms are full screen so
there are no menus and users can't show the DB window.

Does anyone know where I can find some code to change the current user's
password? I want to either open the standard change password dialog or
create another form with a couple of text boxes and a cmd button. I've
looked on Lebans, Allen Browne and, MVPS websites & can't find the answer.
Also googled a bit.

Damien
 
D

Damien McBain

Thanks Douglas, I don't know how I missed that!

The solution posted there doesn't appear to work. Access doesn't like the
data types "Workspace" or "User" (User-defined type not defined). I'm using
Access2k sp3 with win2k sp4.
I copied and pasted this from the ms ws:

Function faqChangePassword (ByVal strUser As String, _
ByVal strPwd As String) As Integer

Dim ws As Workspace
Dim usr As User

Set ws = DBEngine.Workspaces(0)
Set usr = ws.Users(strUser)
usr.NewPassword "", strPwd

End Function

Do I need to define custom types or am I doing something else wrong?

Damo
 
D

Douglas J. Steele

Do you have a reference set to DAO?

With any code module open, select Tools | References from the menu bar,
scroll through the list of available references until you find the one for
Microsoft DAO 3.6 Object Library, and select it.

I'm assuming that you're currently using ADO in your application if you
don't already have a reference set to DAO.

Note that If you have references set to both ADO and DAO, you'll find that
you'll need to "disambiguate" certain declarations, because objects with the
same names exist in the 2 models. For example, to ensure that you get a DAO
recordset, you'll need to use Dim rsCurr as DAO.Recordset (to guarantee an
ADO recordset, you'd use Dim rsCurr As ADODB.Recordset)

The list of objects with the same names in the 2 models is Connection,
Error, Errors, Field, Fields, Parameter, Parameters, Property, Properties
and Recordset
 
D

Damien McBain

Douglas J. Steele wrote:
snip
Do you have a reference set to DAO?
snip

No I didn't - I added it in and it compiles now. Thanks Doug - much
appreciated.

Damo
 

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