Solved

Microsoft Access 2003 Run Time Error 2585

Posted on 2012-04-05
8
300 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

863 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

21 Experts available now in Live!

Get 1:1 Help Now