Coding for a log on screen

  • Thread starter Thread starter leo_davies
  • Start date Start date
L

leo_davies

Guest
Hi,

I’ve got two text boxes on a form, one for a username, and the other for a password. I am trying to use code for 2 different users to enter their details, and providing the details are correct, they will be taken to another screen.

I know nothing about Visual Basic, and from the limited knowledge I have I came up with this:

Private Sub Command4_Click()

If Username = “User” And Password = “pass” Then Run

ElseIf Username = “Admin” And Password = “pass2” Then Run

End If

End Sub


And that’s all I’ve got. I have created a macro which will open the required form, and would obviously like to run this macro if the correct username and password are entered (but I don’t know how to code the running of a macro!)

So, will the code I’ve got work? If not, then could somebody tell me a code that will work? Could someone also finish the code so that the macro (called MCR_USER) will run if the correct username and password are entered?

Thanks for any help
 
I believe there is a log in example (or two) in the Sample Databases Forum - if you search.
 

Users who are viewing this thread

Back
Top Bottom