Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2001
    Posts
    1

    Unanswered: Query is too complex

    I tried this code, which i can't see any problem.


    ==============================================

    con.Open "Provider = Microsoft.Jet.OLEDB.4.0;Persist Security Info= False;Data Source = " & App.Path & "\users_db.mdb;Jet OLEDBatabase Password = user_password"

    With rs
    .ActiveConnection = con
    .Source = "SELECT * FROM Users WHERE USERNAME='admin'"
    .Open
    End With

    If txtPassword.Text = rs.Fields("PASSWORD") Then
    msgbox "login success, admin login"
    End If



    =============================================


    When i execute it, it says

    Run-time error '-2147467259 (80004005)':
    Query is too complex.




    I don't think this query is complex.


    I use MSAccess, office 97 version, with fields

    ID, USERNAME, FIRST_NAME, LAST_NAME, PASSWORD, ACCESS

    all fields are text except ID which is autonumber.



    I'm desperately needing help on this, and with this problem, I can't seems to execute any SQL statement with WHERE clause in it. I can excute the above without the WHERE, but i need to use WHERE somewhere else.


    thanks


    Kelvin

  2. #2
    Join Date
    Oct 2001
    Location
    Bay Area, CA
    Posts
    117
    You are using ADO. try to open your recordset using DAO. Here's an example.

    Set db = CurrentDb()

    'open recordset
    strSQL = "SELECT * FROM Users WHERE USERNAME='admin'"
    Set rs = db.OpenRecordset(strSQL)

    If txtPassword.Text = rs.Fields("PASSWORD") Then
    msgbox "login success, admin login"
    End If

    'close recordset
    rs.Close
    Set db = Nothing

Posting Permissions

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