Results 1 to 4 of 4

Thread: ADO please help

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2001
    Location
    Jamaica
    Posts
    3

    Angry ADO please help

    Hello In a MDI application, I have a login form that is not a child. there is an ado data control that is linked to a user table that allows users to be added and removed from the database application. In the click event for cmdOK after the user enters their user name and password, I wrote the following code:
    adoUser.recordset.find "Rights ='" & txtUserName.Text & "'"
    The problem is Whenever the user clicks ok error message 91 comes up saying, "object variable or with block not set". What could possibly be the problem

    Thanks in advance for any help
    mooresamad

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Post your code

  3. #3

    Thread Starter
    New Member
    Join Date
    Dec 2001
    Location
    Jamaica
    Posts
    3
    Here is the code: I declared rsUser as adodb.recordset in the general declarations area.
    rsUser.Open
    rsUser.MoveFirst
    rsUser.Find "Rights ='" & txtUserName.Text & "'"
    If rsUser.EOF = True Then
    MsgBox "Sorry This username does not exist", vbInformation _
    + vbOKOnly, "Invalid Username"
    ElseIf rsUser("Password") = txtPassWord Then
    Unload frmLogin
    Else
    MsgBox "Sorry, incorrect Password", vbInformation _
    + vbOKOnly, "Password Error"
    End If

    I hope this helps to make my problem clear.
    mooresamad

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    public rsuser as adodb.recordset



    Code:
    set rsuser = new adodb.recordset 
    'Did you include this too?
    
    rsUser.Open 
    'HEY!!!! ***????
    
    
    rsUser.MoveFirst 
    rsUser.Find "Rights ='" & txtUserName.Text & "'" 
    
    
    
    If rsUser.EOF = True Then 
    MsgBox "Sorry This username does not exist", vbInformation _ 
    + vbOKOnly, "Invalid Username" 
    
    ElseIf rsUser("Password") = txtPassWord Then 
    Unload frmLogin 
    
    Else 
    MsgBox "Sorry, incorrect Password", vbInformation _ 
    + vbOKOnly, "Password Error" 
    
    End If
    I think having an SQL query string would be very helpful
    for example

    rsuser.open "SELECT * from members", objconn, adopenstatic, adlockreadonly


    Objconn is your adodb.connection. Please tell me you have one.

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