Private Sub Command1_Click(Index As Integer)

      If KeyAscii = vbEnter Then
      If Len(Trim(txtlogin)) > 0 And Len(Trim(txtpwd)) > 0 Then
      If CheckPwd(txtlogin, txtpwd) = "ok" Then
      MsgBox "Password ok"
      MsgBox "Wrong password or Login not found."
      End If
      MsgBox "Login and password should not be blank"
      End If
      End If
      End Sub
      Private Function CheckPwd(cLogin As String, cPwd As String)
      'in my case i will use dao. you probably using ado just convert it
        Dim rs As Recordset, ret As String
        Set rs = opendatabase("D:\student\vb\Database1.mdb").openRecordset("select * from Table1 where ucase(trim(logname)) = '" & UCase(Trim(cLogin)) & "'")
      If rs.RecordCount <> 0 Then
      If UCase(Trim(rs(pword))) = UCase(Trim(cPwd)) Then
      ret = "ok"
      ret = "wrong"
      End If
      ret = "wrong"
      End If
      rs.Close: CheckPwd = ret
      End Function

This is my code for login page.....i had attached wat error i m gettin ........so i need solution .....can any one help me plz!!!!!!!!!! i m using access database....

Edited by peter_budo: Keep It Clear - Do wrap your programming code blocks within [code] ... [/code] tags

6 Years
Discussion Span
Last Post by AndreRet

Prakash, you are a new member here, but we still need you to read our posting rules. You have "hijacked" someone elses thread, and it is from 2006.

I have already asked the moderators to move your question into it's own post.:)

As far as your question is concerned, rs is referring to a recordset in dao. Use the following code -

Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
rs.Open ".........Your select statement here"

Also ensure that you have MS ActiveX Dataobjects referenced in your application.

Edited by AndreRet: n/a


It's a pleasure. Is the code working for you? If so, please mark this thread as solved, thanks.:)

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.