Password Macro

G

Guest

I made a macro to open the users and group accounts window and linked it to a
command button so users can set their password. Is there a way to make it
default to the change password tab so they do not start on the users window?

Also regular uses do not see the groups tab but users in the admins group
do. Will the macro need to specify something different for the different
groups? As the Change password Tab is 3rd for the admins, and 2nd for
regular users.

Thanks,
 
B

Bill Mosca, MS Access MVP

Denise

If all you need the security dialog for is to allow users to set/change
their passwords, you might want to create your own form and use ADOX to
handle it.

Add the ADO ext. for security and DDL library to your references. This code
is used to change existing passwords. If you create a form with 3 text boxes
(user name, old password, and new password) you cna use those values as
arguments to call the function.

Public Function ChangePassword(ByVal strUserID As String, ByVal strNewPWD As
String, _
ByVal strOldPWD As String) As Boolean
'Purpose : Change password of existing user
'DateTime : 10/28/2003 08:16
'Author : Bill Mosca

Dim cat As New ADOX.Catalog
Dim cnn As ADODB.Connection

Set cnn = CurrentProject.Connection
cat.ActiveConnection = cnn


' Change the password for the user
cat.Users(strUserID).ChangePassword strOldPWD, strNewPWD


ChangePassword = True

Set cat = Nothing
cnn.Close
Set cnn = Nothing


End Function
 
G

Guest

I can't add any more forms to the database. I had to delete some already to
be able to convert it to an MDE file and I am using all the ones that are
left. Is there not a way to do it otherwise? I also have no idea how to do
what you just said as I'm not very adept with VBA. All I have done with it
thus far is copy paste code that I've gotten from other people. Which I could
do with the code you gave me, but I have no idea what you mean by adding the
ADO Ext to the library and it still doesn't solve the problem of already
having too many forms.

Thanks,
 
B

Bill Mosca, MS Access MVP

Whoa, Denise! How many forms do you have? The only limit I know of is
over-all file sizeof 2 gigs, 32,768 objects and up to 1000 modules (forms
usually have a module, but don't always have to).

If you had to delete forms to be able to create an MDE, I suspect the ones
you deleted were OK but wouldn't compile.
 
G

Guest

There must be something hidden. I got an error message when I attempted to
make it into an MDE file. I deleted 2 or 3 forms we were no longer using and
it worked. Some of the tables have near 1000 records in them, not sure if
that makes a difference, I only have 30 forms, and 2 extra modules. I did
not create the database so I am not sure what they did before I got my hands
on it. There are also 29 tables, 62 queries, 49 reports, and 62 macros. It
is a 93.9KB compacted before making it into an MDE file.
 
B

Bill Mosca, MS Access MVP

Denise

The problem is not the number of forms or database size or number of
records. A thousand records is not much of anything. If the database is as
small as yours, the problem lies elsewhere.

When you cannot create an MDE, it usually is because the code will not
compile.

As to your macro, I really don't think there is a way to do what you want.
regular users do not see the groups tab because they do not have permissions
to modify groups.

To add the ADO library, open the code window and click on Tools>References.
Find the Microsoft ADO ext for DDL and Security. Check the box to its left
to add the library.
 
R

Rick Brandt

Denise said:
There must be something hidden. I got an error message when I
attempted to make it into an MDE file. I deleted 2 or 3 forms we
were no longer using and it worked. Some of the tables have near
1000 records in them, not sure if that makes a difference, I only
have 30 forms, and 2 extra modules. I did not create the database so
I am not sure what they did before I got my hands on it. There are
also 29 tables, 62 queries, 49 reports, and 62 macros. It is a 93.9KB
compacted before making it into an MDE file.

That is a wee, tiny, diminutive Access file. If you had to delete objects to
create an MDE it's because those objects had code errors in them, not because of
size.
 
G

Granny Spitz via AccessMonster.com

Denise said:
I made a macro to open the users and group accounts window and linked it to a
command button so users can set their password. Is there a way to make it
default to the change password tab so they do not start on the users window?

Change the macro name in the button's on click property of the properties
window to [Event Procedure] and press the elipses button (...) to open the
code window. Paste this code in the click event of this button, then save
and compile the code:

SendKeys "^+{TAB}", False
RunCommand acCmdUserAndGroupAccounts

Switch to form view and press the button on the form.
Will the macro need to specify something different for the different
groups? As the Change password Tab is 3rd for the admins, and 2nd for
regular users.

No, this VBA code will open the *last* tab in the dialog window, whether it's
the 2nd or 3rd one.
I got an error message when I attempted to
make it into an MDE file.

The most common reason for not being able to convert to an MDE is because the
code isn't compiled, but you may have had to delete some forms to create the
MDE file because the file may have been using too many table IDs. This
happens when you have lots of linked tables and queries that use queries that
use those linked tables, and lots of subforms, combo boxes and list boxes
bound to these queries.
 
G

Guest

Thank you very much that worked.
"The most common reason for not being able to convert to an MDE is because the
code isn't compiled, but you may have had to delete some forms to create the
MDE file because the file may have been using too many table IDs. This
happens when you have lots of linked tables and queries that use queries that
use those linked tables, and lots of subforms, combo boxes and list boxes
bound to these queries."

The database does have several tables used for combo boxes in forms as well
as queries using other queries. I'm not too worried about it, as I deleted a
few forms that we were not using and it worked.

I think I am all set now. Thanks again.

--
Denise


Granny Spitz via AccessMonster.com said:
Denise said:
I made a macro to open the users and group accounts window and linked it to a
command button so users can set their password. Is there a way to make it
default to the change password tab so they do not start on the users window?

Change the macro name in the button's on click property of the properties
window to [Event Procedure] and press the elipses button (...) to open the
code window. Paste this code in the click event of this button, then save
and compile the code:

SendKeys "^+{TAB}", False
RunCommand acCmdUserAndGroupAccounts

Switch to form view and press the button on the form.
Will the macro need to specify something different for the different
groups? As the Change password Tab is 3rd for the admins, and 2nd for
regular users.

No, this VBA code will open the *last* tab in the dialog window, whether it's
the 2nd or 3rd one.
I got an error message when I attempted to
make it into an MDE file.
 
G

Granny Spitz via AccessMonster.com

Denise said:
Thank you very much that worked.

You're welcome, Denise. Glad it worked without you having to do a lot of
extra work.
I'm not too worried about it, as I deleted a
few forms that we were not using and it worked.

Ok, but I think I'd be concerned that it might happen again if I had to add
more changes to the database in the future.
 
L

Larry Linson

Denise Pollock said:
There must be something hidden. I got an error message when I attempted
to
make it into an MDE file. I deleted 2 or 3 forms we were no longer using
and
it worked. Some of the tables have near 1000 records in them, not sure if
that makes a difference, I only have 30 forms, and 2 extra modules. I did
not create the database so I am not sure what they did before I got my
hands
on it. There are also 29 tables, 62 queries, 49 reports, and 62 macros.
It
is a 93.9KB compacted before making it into an MDE file.

Not to worry (about the number of objects). Back in Access 2.0 days, I
worked on a database that had a total of around a thousand objects
(tabledefs, querydefs, forms, reports, macros, and modules). It had its
challenges, but number of objects was not one of them.

Many users report satisfactory stability and performance with Access (Jet)
databases that have hundreds of thousands or millions of records.

Larry Linson
Microsoft Access MVP
 

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