Solved

Microsoft Access 2003 Run Time Error 2585

Posted on 2012-04-05
8
299 Views
Last Modified: 2012-04-15
I am using this code to prompt adding a user to the database
If Me.thisuser <> Me.cboEmployee Then
Dim strMsg As String
DoCmd.Minimize
    strMsg = "New User Prompt "
    strMsg = strMsg & "Do you wish to be added as a new user? "
    strMsg = strMsg & "Click Yes to Save or No"
    If MsgBox(strMsg, vbQuestion + vbYesNo, "New User? ") = vbYes Then DoCmd.OpenForm ("frmnewrec")
    DoCmd.Save
    DoCmd.CancelEvent
   
   
     
        'do nothing
    Else
       
I want to close frm logon and open frmnewrec but get that runtime eror 2585 while trying to close. The code is in the on current field. I have tried the activate but no help. Be gone for the weekend but will be checking. Thanks for the help.
0
Comment
Question by:mrdbmagic
  • 5
  • 2
8 Comments
 
LVL 77

Expert Comment

by:peter57r
ID: 37815274
WHere are you running this code?

I can see where you open frmnewrec but there is no command to close frmlogon?

What do you intend these two commands to do..(I don't think they are doing anything useful, but I don't know what you want to do)

     DoCmd.Save
     DoCmd.CancelEvent
0
 
LVL 1

Author Comment

by:mrdbmagic
ID: 37823116
When the error first came up I searched for solutions and they were two that I found. It didn't work.
0
 
LVL 1

Author Comment

by:mrdbmagic
ID: 37823124
I am trying to create a new user routine where they don't have to type the name each time the database will get it from  Environ("username"). If the user is not in the table the routine will prompt the user to create a new password and add them.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 37823800
Are you saying that your system is allowing users to add *Themselves* as users?
This should be an administrative function...

Then AFAICT none of this would even be an issue...

Why are "Non-Users" allowed to log on to the DB in the first place?
Again, ...adding users should be an administrative function.

There should be a list of valid users, in a table.
All of which will have a dedicated User name and a password. (and possibly a "Security Level", associated with that UserName/Password combination)
Note that you really should not depend solely on just Environ("username"), because this is based on the Domain.
It also exposes a security hole where if the user does not log off the domain, (Whenever they step away from their PC), another person can simply "Open" the database.
*Also* just using the Environ("username"), does not allow for any controls on what the user can and cannot do, once in the DB.
These things are all better controlled by an administrative system to control user access to the DB.

If a person tries to log onto the DB, and they are not on this list, they are rejected.

They would then go to the DBA and ask for a User name and Password.
Then, (If approved), the DBA will add them to the "Users" table with a user name and password (and again, possibly a Security Level)
Then they should be able to log in...

This is the way this is commonly done.
There are many examples here of simply systems to validate users in this scenario.


In other words, I am not understanding the logic behind your existing system...?
(Users add "themselves" to the list of valid users...)
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 1

Author Comment

by:mrdbmagic
ID: 37823937
An administrator already has approved the user's access to the folder the database is located in.  I am adding security to the database. I did find a not on list code that may work. I was trying to simplify a new user getting in, the database recognizing them as a new user then Prompt them for the password. We are also concerned about users using other users passwords. the Envron("username") I think will prevent this. I will also be adding a function to record changes made to the records in the database based on the user that logged in. I know that you can do this without the login but the manager wants an added security.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 37824603
I'm still not sold of your approach to Adding the users though...

I'll let you continue on with the other experts...
0
 
LVL 1

Accepted Solution

by:
mrdbmagic earned 0 total points
ID: 37827293
I ended up using a not on list event and this solved my problem.
0
 
LVL 1

Author Closing Comment

by:mrdbmagic
ID: 37847940
The solution worked.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now