Results 1 to 3 of 3
  1. #1
    Ballphereon is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2012
    Posts
    2

    Post Login form with special condition

    Hi,

    I'm still newbie with ACCESS n VBA code.
    I have a form and a table login(user, password, role)where user can login with username and password by referring to Login table.

    Private Sub LOGIN_Click()

    Dim LOGIN As String
    Dim rs As Object
    If Me.txtuser.value <> "" And Me.txtpassword.value <> "" Then

    GENERATE = "select * from login where Username ='" & Me.txtuser.value & "' and Password ='" & txtpassword.value & "'"

    Me.RecordSource = GENERATE
    Set rs = Me.RecordsetClone
    If Not rs.EOF Then
    MsgBox "YOU ARE LOGIN AS' " & MeLogin.rule & "'"
    Else
    MsgBox "Your Username and Password doesnt Match!!"
    End If

    Else
    MsgBox "Please Input your username and password to Login"
    End If

    End Sub

    How can i view the role in MsgBox according to username and password in table login? Im having trouble in here (Underline words). The Logic is if username and password has been filled and then search in table. If Its TRUE then it will show MsgBox with the role user in table Login.



    Or do you have any better codes for this?
    Thanks for help..


    Best Regards,

    Rivai

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    There is a thread here with some samples I haven't used them but thought I'd pass the info and you can decide.
    http://forums.databasejournal.com/sh...ad.php?t=45488

    http://forums.databasejournal.com/at...9&d=1178347202

    Another
    http://www.databasedev.co.uk/login.html

  3. #3
    Ballphereon is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2012
    Posts
    2
    Thanks for the example Sir. But I dont wanna use combo box. because i want user to fill themselves. I want to use n apply the code for another application. Like Verification Code. So If u fill code 1 (user) and code 2(password) and match in table there will be a msgbox n inform the role or the prizes whether 1st prize or 2nd prize depends on verification code in table. Im having trouble with the query to display prize or role in MsgBox. I'm still newbie here and need guidance. Just thinking out of the box. I hope u can help me Sir. I dont know what i should use DLOOKUP function or object. Apologize for any mistakes.

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

Similar Threads

  1. Replies: 1
    Last Post: 12-11-2011, 11:48 AM
  2. Login form with nt login
    By hitesh_asrani_j in forum Forms
    Replies: 6
    Last Post: 09-22-2011, 11:43 AM
  3. Login Form
    By Kookai in forum Access
    Replies: 3
    Last Post: 10-18-2010, 04:23 PM
  4. Replies: 5
    Last Post: 08-13-2010, 07:26 PM
  5. Where Condition - form error
    By catat in forum Forms
    Replies: 5
    Last Post: 07-15-2010, 07:40 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