Results 1 to 4 of 4
  1. #1
    eww is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Aug 2010
    Posts
    125

    Login/Password Code not working

    I'm trying to set up a simple login screen for users to access one of the forms. Right now I'm keeping things simple and using their names as the login and then a password stored in a table. The login is a combo box in which they select their names, then they type in their password below and click on a command button to execute. I'm trying to use this code to make it all work:

    Private Sub Command11_Click()
    If Me.txtPassword.Value = Me.cboLogin.Column(5) Then
    DoCmd.OpenForm frmTimeSheet, acNormal, , , acFormEdit, acWindowNormal
    Else
    MsgBox "Password Invalid. Please Try Again."
    End If
    End Sub

    But it doesn't seem to be working. The button takes me to the right form, but if I type in the wrong password it still takes me to that form which tells me this isn't working right. Both the login and password fields are unbound for the obvious reason that I don't want to be storing this over and over again.

  2. #2
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    set a break point on the IF line. then debug to see what value is in Me.txtPassword.Value and Me.cboLogin.Column(5) .

  3. #3
    Rawb is offline Expert
    Windows XP Access 2000
    Join Date
    Dec 2009
    Location
    Somewhere
    Posts
    875
    Remove the .Value from Me.txtPassword.Value and it should work.

  4. #4
    eww is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Aug 2010
    Posts
    125
    This seems to be one of those times where I was just dumb and didn't do enough investigating. It appears I left an old macro in place of the embedded click command of the button instead of using the code. Thanks for the help though guys, I probably would have continued to overlook it without your replies.

    Also my code did have an error, there needs to be quotations around frmTimeSheet.

    Sorry for the somewhat unnecessary post.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. DLookup code not working
    By lukekelly in forum Programming
    Replies: 9
    Last Post: 06-15-2010, 06:08 AM
  2. VB code not working
    By cwwaicw311 in forum Programming
    Replies: 17
    Last Post: 04-26-2010, 07:02 PM
  3. VBA Code for working with IE
    By smikkelsen in forum Programming
    Replies: 3
    Last Post: 04-15-2010, 01:05 AM
  4. Replies: 4
    Last Post: 05-12-2009, 01:50 PM
  5. Simple Nav Form Code Not Working
    By alsoto in forum Forms
    Replies: 10
    Last Post: 04-10-2009, 09:30 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums