Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2003
    Posts
    5

    Question Unanswered: ADO Recordset Open Error

    Hi People,

    I have a ADO recordset i want to open as follows:

    sql1 = "select * from Receipts where Custname ='Jack'"
    rs.CursorLocation = adUseClient
    rs.CursorType = adOpenForwardOnly
    rs.LockType = adLockReadOnly
    rs.Open sql1, cn

    The code above works fine. I'm trying to be more flexible and give the user a text box to provide the own name to search. So I have a textbox called txtCustname.
    I modify my code to the following:
    sql1 = "select * from Receipts where Custname =txtCustname.txt "
    rs.CursorLocation = adUseClient
    rs.CursorType = adOpenForwardOnly
    rs.LockType = adLockReadOnly
    rs.Open sql1, cn

    I get the error msg "No value given for one or more required parameters" with rs.Open sql1,cn highlighted.

    Where am I getting lost? Thanks for all your replies.

  2. #2
    Join Date
    Feb 2002
    Posts
    2,232
    Modify the following:

    sql1 = "select * from Receipts where Custname =txtCustname.txt "

    with:

    sql1 = "select * from receipts where custname = '" & txtCustname.txt & "'"

    You need to put single quotes around strings.

  3. #3
    Join Date
    Dec 2003
    Posts
    5

    Talking It Worked!

    Perfect! That Worked. Thank You!

Posting Permissions

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