Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2004

    Unanswered: Need help with a login form

    I'm looking for an answer to something that I know can be done, but I haven't found out quite how. I searched as much as possible to find it, but I only found parts. So here we go (this is my first posting, so hopefully everyone can understand it):

    I have a form for entering results for a test into. This is for a multi user environment. I made a small login form also with a place to type a user name and a password. The idea here is that a person types a user name and a password, and as long as both match what's in the table, then it's suppose to open the form to the entry that has only their User name (there will only be one record per person). Currently I have a separate table with user names and passwords.

    The question is how do I go about setting up this login form to check if what has been entered matches the ID and password in the one table, then opens the form up and automatically sets it up with that same user's record.

    After messing with the built in security, I found that it was needlessly complicated and more than this project required (security isn't THAT big of an issue, but I don't want people to go to other people's records). I'm trying to keep this as simple as possible. Part of the problem is that I'm not familiar with visual basic. Anyone who can enlighten me on this subject would be considered royalty in my eyes. Thanks for any help.


  2. #2
    Join Date
    Mar 2004
    Here is some sample code to verify if that UserName/Password combination is valid:

    Dim cn as ADODB.Connection
    Dim rs as ADODB.Recordset
    Set cn = new ADODB.Connection
    cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Password=TestPass;Data Source=C:\Test.mdb;Persist Security Info=False;Exclusive=0"
    set rs = new ADODB.recordset
    rs.ActiveConnection = cn
    rs.Open "SELECT * FROM Table1 WHERE USerName='" & txtUser & "' AND Password='" & txtPassWord "'"
    If Not (rs.Bof and rs.Eof) Then
        MsgBox "Correct Username/Password"
        MsgBox "Incorrect Username/Password"
    End If
    Set rs=Nothing
    Set cn = Nothing

    Download for FREE the ADO/DAO Data Controls that makes life EASIER developing database applications in: VB, FoxPro, Access, VC++, .NET etc... Navigate, Add New, Delete, Update, Search, Undo and Save your changes. Supports Disconnected Recordsets and Transactions!

    Or try our Ask An Expert service to answer any of your questions!

  3. #3
    Join Date
    Feb 2004
    Attached is a zip file with examples for Access97 and Access2000. It contains the following objects:

    UserData - Sample Data for each user
    Users - Sample User and Password information



    The two users for the sample are:
    UserName: JOHN
    Password: doe

    UserName: RICHARD
    Password: roe

    These sample databases give a very basic idea that should put you on track of what you are looking for.
    Attached Files Attached Files

  4. #4
    Join Date
    Jul 2004

    Thanks so much!

    Just wanted to thank you both for helping a lost soul. It's always refreshing to know that somone out there can guide you in the dark times. Thanks again!


  5. #5
    Join Date
    Mar 2003
    The Bottom of The Barrel
    Provided Answers: 1
    Quick question, are you using an mde etc?

    If the code, specifically tables, are not protected, then there is little stopping the user from getting other peoples names and passwords. If you are running on an nt based system (2k, xp etc), it may be better to pull their windows logon instead.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  6. #6
    Join Date
    Jul 2004
    Using their network ID would be nice, except these are QA labs where several people are using the same computer. Also, the information isn't anything that would really hurt someone if it got out.

    What the project has to do with is a check sample program. Everyone runs a test on the same sample and reports their results. Everyone's results are averaged, and this becomes the target value that everyone is compared to. When the report is created, only an ID number, instead of a name, is displayed. This is because only each person's answers matter to them. Comparing to a specific other person doesn't help. It's how one does compared to the average. So the password thing is to just keep everyone from seeing other's results. I just have to make the project hidden enough that people who don't know how to get into a program (most of the people that are in these labs have limited knowledge on running a computer. Not a put down, just how it is).

    The project right now is a .mdb How it will be distributed still has to be worked out. I'm just trying to get the guts of it working. Hope that clears it up for you. Thanks for asking though.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts