+ Reply to Thread
Page 2 of 2 FirstFirst 12
Results 16 to 19 of 19

Thread: Query searching returns incorrect results

  1. #16
    Forum Guru davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2007
    Posts
    1,879

    Re: Query searching returns incorrect results

    When you go into the query editor, there should be a button on a toolbar that changes the query from design view to view to SQL view to datasheet view. It wil probably look like a data table, and it will have a small black arrow pointing down next to it. Press the black arrow, then click on the option that says SQL. This will bring up the text of the SQL query. Copy that and show us what it is.
    Is your code running too slowly?
    Does your workbook or database have a bunch of duplicate pieces of data?
    Have a look at this article to learn the best ways to set up your projects.
    It will save both time and effort in the long run!


    Dave

  2. #17
    Registered User
    Join Date
    11-07-2009
    Location
    australia
    MS-Off Ver
    Excel 2003
    Posts
    79

    Re: Query searching returns incorrect results

    ok here ya go

    SELECT [Movie Database List].Volume, [Movie Database List].[Movie Title], [Movie Database List].Rating
    FROM [Movie Database List]
    WHERE ((([Movie Database List].Volume) Like "*" & [Forms]![search].[volume] & "*") AND (([Movie Database List].[Movie Title]) Like [Forms]![search]![title] & "*") AND (([Movie Database List].Rating) Like [Forms]![search]![rating] & "*")) OR ((([Movie Database List].[Movie Title]) Like [Forms]![search]![title] & "*") AND (([Movie Database List].Rating) Like [Forms]![search]![rating] & "*") AND (("_
    Forms!search!volume") Is Null)) OR ((([Movie Database List].Volume) Like "*" & [Forms]![search].[volume] & "*") AND (([Movie Database List].Rating) Like [Forms]![search]![rating] & "*") AND (("_
    Forms!search!title") Is Null)) OR ((([Movie Database List].Rating) Like [Forms]![search]![rating] & "*") AND (("_
    Forms!search!volume") Is Null) AND (("_
    Forms!search!title") Is Null)) OR ((([Movie Database List].Volume) Like "*" & [Forms]![search].[volume] & "*") AND (([Movie Database List].[Movie Title]) Like [Forms]![search]![title] & "*") AND (("_
    Forms!search!rating") Is Null)) OR ((([Movie Database List].[Movie Title]) Like [Forms]![search]![title] & "*") AND (("_
    Forms!search!volume") Is Null) AND (("_
    Forms!search!rating") Is Null)) OR ((([Movie Database List].Volume) Like "*" & [Forms]![search].[volume] & "*") AND (("_
    Forms!search!title") Is Null) AND (("_
    Forms!search!rating") Is Null)) OR ((("_
    Forms!search!volume") Is Null) AND (("_
    Forms!search!title") Is Null) AND (("_
    Forms!search!rating") Is Null));
    That's the complete code via SQL view.

  3. #18
    Forum Guru davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2007
    Posts
    1,879

    Re: Query searching returns incorrect results

    Hmm, nothing jumps out at me. Try this instead:

    SELECT [Movie Database List].Volume, [Movie Database List].[Movie Title], [Movie Database List].Rating
    FROM [Movie Database List]
    WHERE ((([Movie Database List].Volume) Like "*" & [Forms]![search]![volume] & "*") AND (([Movie Database List].[Movie Title]) Like "*" & [Forms]![search]![title] & "*") AND (([Movie Database List].Rating) Like "*" & [Forms]![search]![rating] & "*")) OR ((([Movie Database List].[Movie Title]) Like "*" & [Forms]![search]![title] & "*") AND (([Movie Database List].Rating) Like "*" & [Forms]![search]![rating] & "*") AND (("_
    [Forms]![search]![volume]") Is Null)) OR ((([Movie Database List].Volume) Like "*" & [Forms]![search].[volume] & "*") AND (([Movie Database List].Rating) Like "*" & [Forms]![search]![rating] & "*") AND (("_
    [Forms]![search]![title]") Is Null)) OR ((([Movie Database List].Rating) Like "*" & [Forms]![search]![rating] & "*") AND (("_
    [Forms]![search]![volume]") Is Null) AND (("_
    [Forms]![search]![title]") Is Null)) OR ((([Movie Database List].Volume) Like "*" & [Forms]![search].[volume] & "*") AND (([Movie Database List].[Movie Title]) Like "*" & [Forms]![search]![title] & "*") AND (("_
    [Forms]![search]![rating]") Is Null)) OR ((([Movie Database List].[Movie Title]) Like "*" & [Forms]![search]![title] & "*") AND (("_
    [Forms]![search]![volume]") Is Null) AND (("_
    [Forms]![search]![rating]") Is Null)) OR ((([Movie Database List].Volume) Like "*" & [Forms]![search].[volume] & "*") AND (("_
    [Forms]![search]![title]") Is Null) AND (("_
    [Forms]![search]![rating]") Is Null)) OR ((("_
    [Forms]![search]![volume]") Is Null) AND (("_
    [Forms]![search]![title]") Is Null) AND (("_
    [Forms]![search]![rating]") Is Null));
    If that doesn't work, I'd try creating a new query now that your table structure has changed, and see if that gives you the results you are looking for.
    Is your code running too slowly?
    Does your workbook or database have a bunch of duplicate pieces of data?
    Have a look at this article to learn the best ways to set up your projects.
    It will save both time and effort in the long run!


    Dave

  4. #19
    Registered User
    Join Date
    11-07-2009
    Location
    australia
    MS-Off Ver
    Excel 2003
    Posts
    79

    Re: Query searching returns incorrect results

    nope still no go .... a partial search is giving me the no results msg box still .... full search is returning the out of memory runtime error.

    I am going to have a play with it over the next few days and will post back later.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.2.0