Results 1 to 4 of 4

Thread: Search

  1. #1
    Join Date
    Mar 2004
    Location
    Atlanta, GA
    Posts
    58

    Unanswered: Search

    I have a form with 3 text boxes and a listbox. I want to be able to type into the text boxes what I want to search for. If 2 of the boxes are filled out I want to search both strings. For example, the textboxes are named txtmodel, txtmake, and txtcolor. If I type a value in txtmodel and txtmake I want to be able to search the table for those values. I just need help on the sql statement. I know I need if isnull statements for each txtbox.

    Thanks..

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    What does the source for the listbox look like? In general, the SQL syntax for multiple string criteria would be:

    "SELECT * FROM YourTable WHERE yourField LIKE '*" & combo1 & "'* OR yourField LIKE '*" & combo2 & "*' OR yourField LIKE '&" etc etc;

  3. #3
    Join Date
    Mar 2004
    Location
    Atlanta, GA
    Posts
    58
    I am setting the listbox to the sql string. I have the following code but it is not working. What am I doing wrong?

    Code:
    "SELECT Inv_ID, StockNbr, UnitStatus, Year, Make, Model, Color, UnitStatus FROM tblInventory WHERE model LIKE '*" & Me.txtModel & "'* OR make LIKE '*" & Me.txtMake & "'* OR color LIKE '*" & Me.txtColor & "'*"
    Thanks..

  4. #4
    Join Date
    Mar 2004
    Location
    Atlanta, GA
    Posts
    58
    I got it.

Posting Permissions

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