Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2011
    Posts
    4

    Unanswered: using like with user input

    HELP!! I am using sql to fill list box matching user input. using like to avoid exact matches. I am only getting empty returns. I have tried every solution I could find online, but nothing seems to produce returns. I should have 4 matches to what I enter, but get blank file.

    sql = "SELECT TBLActivities.actDateReceived, TBLActivities.actTypeSupport, TBLActivities.actProviderName," _
    & " TBLActivities.actProblem, TBLActivities.actTextStatus, TBLActivities.actComments" _
    & " FROM TBLActivities WHERE TBLActivities.actProviderName LIKE '*" & textsearch.Value & "*'"

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    This seems correct, though. I would first check what sql contains immediately after it is assembled. How do you use sql after assembling it?
    Have a nice day!

  3. #3
    Join Date
    Aug 2011
    Posts
    4
    this is the rest of the code. The code works if I use fixed value but not with a variable. using Windows 7 Home and Access 2007.

    rsactivity.Open sql, localconnection
    Do While Not rsactivity.EOF
    listReturns.AddItem rsactivity!actDateReceived & ";" & _
    rsactivity!actProviderName & ";" & _
    rsactivity!actProblem & ";" & rsactivity!actTextStatus & ";" & _
    rsactivity!actComments
    rsactivity.MoveNext
    Loop
    rsactivity.Close

    I appreciate any advise I can get to make this work.

  4. #4
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Can you check the contents of the variable sql before opening the recordset?
    Have a nice day!

Posting Permissions

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