Results 1 to 6 of 6

Thread: search function

  1. #1
    Join Date
    Jun 2003
    Location
    Bloomington, IN, USA
    Posts
    116

    search function

    How would one go about setting up a 'search by keyword' type function? Basicly was thinking of a text box for what you want to look for, then click the button and it goes through row by row looking for that string in any position of any records 'name' field.

    Any help from anyone?

  2. #2
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254
    If it is known columns it will be easy. if it should go through all the text columns in a table, then you have to have metadata information stored in a table and you can scroll through that for getting column information and then do a search on the table.

    If it is sql server you can use Full text search.

  3. #3
    Join Date
    Jun 2003
    Location
    Bloomington, IN, USA
    Posts
    116
    yeah it will be in a specific column, and its not an sql server, its access...

  4. #4
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254
    say you have to search on 3 columns on a table. Say col1,col2 and col3 are columns.

    select * from table where
    col1 like '*xyz*' or
    col2 like '*xyz*' or
    col3 like '*xyz*'

  5. #5
    Join Date
    Jun 2003
    Location
    Bloomington, IN, USA
    Posts
    116
    ok...does that get exact matches or something? cus its not working at all...

    I made a query and put on the project_name column that I wanted the ones that were LIKE forms!frmnamesearch.txtName and its comeing up blank....

    am i dumb and misunderstanding you?

    brandon

  6. #6
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254
    output the query that you are creating using msgbox or another text box and run the output in Access query.

    you can copy and paste the query here.

    Your query formation should be like below

    Dim query As String

    query = "select * from table where col1 like '*" & Me!Text0 & "' or col2 = '*" & Me!Text0 & "'"

    msgbox query

Posting Permissions

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