Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Microsoft Access 2003 Run Time Error 2585

Posted on 2012-04-05
8
Medium Priority
?
311 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

618 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