Solved

Microsoft Access 2003 Run Time Error 2585

Posted on 2012-04-05
8
308 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
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
 
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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

688 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