Results 1 to 4 of 4

Thread: <Help>Logon Password in MS ACCESS

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2004
    Location
    Bahrain
    Posts
    306

    <Help>Logon Password in MS ACCESS

    Hi Guys,

    I'm trying to make a Username and password for the users who use the database. I want to make a form that has txtUserName , txtPassword and CmdOk. I have a table "Users" this table has two fields "UserName" and "Password".

    what I've made is this, but it gives me an error. [No value given for 1 or more requiered parameteres]

    Code:
    Private Sub cmdOK_Click()
    Dim sql1, sql2 As String
    Dim db As ADODB.Recordset
    Dim c1 As New ADODB.Connection
    
    Set c1 = New ADODB.Connection
    c1.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & "F:\Login Form.mdb"
    Set db = New ADODB.Recordset
    
    txtUserName.SetFocus
    sql1 = "select * from users where UserName=" & txtUserName & " And "
    txtPassword.SetFocus
    sql2 = "Password=" & "'" & txtPassword & "'"
    
    db.Open sql1 & sql2, c1, adOpenStatic, adLockOptimistic
    
    If db.RecordCount = 0 Then
    MsgBox "Please check your user name and password.", vbCritical, "L.S.S.I"
    Else
    DoCmd.OpenForm "Form_1", acNormal
    Unload Me
    End If
    Could someone help me in this issue please?


    many thanks in advance.

    Habibalby
    Attached Files Attached Files

Posting Permissions

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



Click Here to Expand Forum to Full Width