Creating a Multi-User Login

S

swlaw

I am trying to create a multi-user login. When I create this in a 'sample'
database it works fine. I create three forms and one login form with the
appropriate VB code. No problems, I can add as many users as I want in the
code.

The problem is when I try to create the exact same login, same code, in my
actual database, for some reason it does not work. I checked all the names
and so on but cannot seem to get it to work.

Any suggestions for something I may be doing wrong.
Please help. :)

This a portion of the code:

Private Sub Login_Current()
Username.SetFocus
If Username = "user1" And Password = "user1" Then
MsgBox "Access Granted", vbInformation, "JMS"
MsgBox "Welcome", vbInformation, "JMS"
DoCmd.Close
DoCmd.OpenForm "Switchboard"
Else
MsgBox "Please re-enter your Username and Password."
End If
End Sub
 
P

Philip Herlihy

"Does not work" can mean an awful lot of things. Forgive me for being lazy,
but my response to this is very like one I posted just a couple of days ago.
If you'd like to have a look here:
http://bit.ly/7ixMqh
.... you may find it leads you to a solution.

Phil, London
 
S

swlaw

Does not work, means that when I log in it is suppose to go to a form. Seems
pretty simple but I am having a hard time? Any suggestions.
 
P

Philip Herlihy

I wonder if the DoCmd.Close is closing the form whose module may turn out to
contain the code you're running, so it never gets to the DoCmd.OpenForm.

However, without using error handling code and setting breakpoints I'm only
guessing. My suggestion was and is that you add error-handling, learn how
to use breakpoints and how to step through code. Not hard, and all there in
Help!

Phil
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top