Results 1 to 2 of 2

Thread: Converting to ADO, Recordset Problem

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2000
    Posts
    43
    I am converting a program to ADO, and have worked out most of the bugs, except the sql query I was using to get a listview is not working now. I was using this code to open a recordset:




    Set rsListData = dbPrimary.OpenRecordset( _
    "SELECT * FROM qryListCustomers WHERE LastName LIKE '" & txtFind.Text & "*" & "'", _
    dbOpenDynaset)





    And getting:





    Run-time error '3001':

    Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.





    Since this is ADODB I changed the code to:



    Set cmdCustomers = New ADODB.Command
    cmdCustomers.CommandText = "SELECT * FROM qryListCustomers WHERE LastName LIKE '" & txtFind.Text & "*" & "'"
    cmdCustomers.CommandType = adCmdText

    Set paramCustomerID = _
    cmdCustomers.CreateParameter("paramCustomerID")
    paramCustomerID.Type = adInteger
    paramCustomerID.Direction = adParamInput
    paramCustomerID.Value = 10
    cmdCustomers.Parameters.Append paramCustomerID

    Set rsListData = New ADODB.Recordset
    rsListData.Open cmdCustomers



    But now I am getting:



    Run-time error '3079':

    Operation is not allowed on an object referencing a closed or invalid connection.



    The error is occurring at rsListData.Open cmdCustomers
    I believe my connection is open. The code I am using for it is:



    dbCust.CursorLocation = adUseClient
    dbCust.Open "Provider=Microsoft.Jet.OLEDB.3.51;" _
    & "Data Source=C:\My Documents\VBasic\IllustrationADO\Customers\Customers2000.mdb;"




    Which is the database holding the tables and query. Any ideas?
    Tim

    VB6, SP4
    GT Vengeance

  2. #2

    Thread Starter
    Member
    Join Date
    Jun 2000
    Posts
    43
    Nevermind, I figured it out. Thanks anyways.
    Tim

    VB6, SP4
    GT Vengeance

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