Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 315
  • Last Modified:

Microsoft Access 2003 Run Time Error 2585

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
mrdbmagic
Asked:
mrdbmagic
  • 5
  • 2
1 Solution
 
peter57rCommented:
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
 
mrdbmagicAuthor Commented:
When the error first came up I searched for solutions and they were two that I found. It didn't work.
0
 
mrdbmagicAuthor Commented:
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
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 
Jeffrey CoachmanCommented:
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
 
mrdbmagicAuthor Commented:
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
 
Jeffrey CoachmanCommented:
I'm still not sold of your approach to Adding the users though...

I'll let you continue on with the other experts...
0
 
mrdbmagicAuthor Commented:
I ended up using a not on list event and this solved my problem.
0
 
mrdbmagicAuthor Commented:
The solution worked.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now