Page 2 of 5 FirstFirst 12345 LastLast
Results 16 to 30 of 73
  1. #16
    Meep is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2011
    Posts
    25

    ----------

  2. #17
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,724
    Well, there is no data at all in your database, so query3 can't be represented. There's nothing I can try or test unless you can give me some typical test data -- nothing confidential.

  3. #18
    Meep is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2011
    Posts
    25
    There is data now.

    (I still want to search query3 "Title" (FirstOfTitle) field, because that table is not my actual table. Thank you.)

  4. #19
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,724
    Just opened your table. Quick question, why are there multiple records of the same
    barcode dbo_items ItemBarcode 092274954 092274954

  5. #20
    Meep is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2011
    Posts
    25
    Quote Originally Posted by orange View Post
    Just opened your table. Quick question, why are there multiple records of the same
    barcode dbo_items ItemBarcode 092274954 092274954
    Idiosyncrasy of the program used to enter records into table; can't be avoided. Hence my grouping. Does this cause problems when writing the code? If so, we could alternatively group the report (Search Results) to remove duplicates.

  6. #21
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,724
    No, it shows an issue with respect to the cleanliness of the data you are working with.

  7. #22
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,724
    Meep,

    I parsed your Titles into a Keywords table, and made a form based on yours. I called the form SearchReserves. It allows you to enter 2 keywords or parts thereof. Open this form to try it.

    It's an access2003 mdb, try it and see what you think.

    This is only looking at the 500 + titles you supplied.

    I have a table called Noise which could be used to remove some keywords from the list to scan.

  8. #23
    Meep is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2011
    Posts
    25
    I appreciate your help, orange, but this doesn't solve my problem, which is that I want the search terms to be entered into a single text box (I won't be the person using this database, and I want it to function like a search engine). With two text boxes I don't understand why parsing the field was even necessary; I could have just used this criterion for the title field: Like "*" & [Forms]![Reserves Database]![TextBox1] & "*" AND Like "*" & [Forms]![Reserves Database]![TextBox2] & "*"

  9. #24
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,724
    Ok, I was think of many many records and a quick index into finding things.

    So where are you at at the moment?

  10. #25
    Meep is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2011
    Posts
    25
    Quote Originally Posted by orange View Post
    So where are you at at the moment?
    Still in need of a keyword search! Guus seemed to posit a solution earlier, but I'm too dumb to implement it.

    Some dude named John Spencer wrote this in another forum in response to the same problem, but I don't know how to test it:

    SELECT *
    FROM SomeTable
    WHERE SomeField Like "*FirstWord*"
    AND SomeField Like "*SecondWord*"

    In order to do what you want you need to build the query criteria on the fly.
    Dim vArray as Variant
    Dim strCon as String
    Dim strWhere as String

    vArray = Split(Me.txtFilter, " ", -1, 0)

    strCon = " AND " 'Must match all words replace with OR to match any

    For iLoop = LBound(vArray) To UBound(vArray)

    If Len(Trim(vArray(iLoop))) > 0 Then
    strWHere= strWhere & _
    StrCon & " fSubject Like ""*" & Trim(vArray(iLoop)) & "*"""
    End If
    Next iLoop


    strWhere = Mid(strWhere, Len(strCon) +1)

  11. #26
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,724
    Here's another attempt. It uses your Form and command button now has code behind it to set up the where clause to find records with matching words in the title.

    It uses form FoundItems to display results.

    Please try it and post back.

    John Spencer is well respected and has great knowledge - especially his SQL solutions to issues.

  12. #27
    Meep is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2011
    Posts
    25
    orange, you're my hero! Thank you so much. This seems to work just the way I want it to.

    Is it necessary that the search results appear in a form rather than a report? This is purely aesthetic and completely trivial on my part.

  13. #28
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,724
    No, but if there is no Title with, say 6 terms, you don't want to print something that's in error.
    Once you have verified that a result was found, you may have to narrow it down. Do you really want to report that these 54 records matched the search terms?

    You could have another button on your form to print a report, but I would rerun the search , then click the Report button. We can help you with this, but we don't really know your environment -- you want the search terms/fragments in one text box for example.
    Have you received the message that no Title exists with the terms you supplied?

    Perhaps you should tell us where this fits in the "big picture".
    For example, you have multiple records because they have different callnumbers in many cases.

  14. #29
    Meep is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2011
    Posts
    25
    I'm sorry; I just meant open a report in report view, not print anything. I'm not asking you to redo the whole thing or something, but if it's a matter of changing a word here or there and designing the report, I could do it. Thanks again.

  15. #30
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,724
    What is it exactly that you want to do?
    The code behind the button will handle any number of terms/fragments as long as they are separated by one or more spaces. It will open another form if there are Titles matching the search terms OR it will give a message that no Titles exist with all of those terms.
    You could close the second form, then click a different button on your form to Preview a Report.

    I don't do anything with author or any other fields in dbo_items.

    Do you have a report designed?

Page 2 of 5 FirstFirst 12345 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. SQL Parameters keyword?
    By Buakaw in forum Queries
    Replies: 1
    Last Post: 08-04-2011, 06:53 PM
  2. Incorrect syntax near keyword “ORDER"
    By k9drh in forum Import/Export Data
    Replies: 1
    Last Post: 06-13-2011, 07:36 AM
  3. Replies: 7
    Last Post: 04-29-2011, 03:44 PM
  4. Making a keyword search
    By timmy in forum Forms
    Replies: 9
    Last Post: 03-14-2011, 02:57 AM
  5. Extracting data after a keyword
    By KerryA in forum Queries
    Replies: 1
    Last Post: 02-11-2010, 09:56 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums