Results 1 to 4 of 4
  1. #1
    stiracerdude is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Posts
    2

    Multi-Field Search issues within Query

    Hello I am doing a project for class and I am just stumped on multi field


    search. I'm sorry if this in the wrong section but I believe my issue in within
    my query, but I'm not sure.

    I have a form that has text fields with
    Location, Zip, Shelters, and Counseling. Also a Run Query button

    FYI
    Shelters and Counseling are text but are designated with a Y or N

    When I
    search by location or zip I have no problems at all, but say I search by
    location and shelters. I then get my correct location, but shelters is showing
    all shelters data within the correct location

    I am a beginner with Access. Also the version I am using if it matters is
    2010


    below is my SQL View

    SELECT Contacts.Agency,
    Contacts.Location, Contacts.[ZIP/Postal Code], Contacts.Shelters,
    Contacts.Counseling
    FROM Contacts
    WHERE (((Contacts.Location) Like "*"
    & [Forms]![Search Form]![Location] & "*") AND ((Contacts.[ZIP/Postal
    Code]) Like "*" & [Forms]![Search Form]![zip] & "*") AND
    ((Contacts.Shelters) Like "*" & [Forms]![Search Form]![Shelter] & "*")
    AND ((Contacts.Counseling) Like "*" & [Forms]![Search Form]![counseling]
    & "*"));

    Thanks

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    So when "Y" or "N" is selected as criteria, still returns all shelters? Every record has either Y or N, no empty fields? The query looks good to me. If you want to provide db for analysis, follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    stiracerdude is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Posts
    2
    Quote Originally Posted by June7 View Post
    So when "Y" or "N" is selected as criteria, still returns all shelters? Every record has either Y or N, no empty fields? The query looks good to me. If you want to provide db for analysis, follow instructions at bottom of my post.
    Thank you for responding. To answer your question yes each record has either Y or N. I think I fixed my problem. I changed it to LIKE[Forms]![SearchForms].[Location] & "*" instead of Like & "*" [Forms]![SearchForms].[Location] & "*". This seemed to fix my problems. I found this link late last night and tried it this morning. http://www.datapigtechnologies.com/f...earchform.html

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    The controls used to input criteria are unbound? Are they textboxes or comboboxes?

    Whether or not the prefix wildcard is needed depends on the input. If it is a textbox where you allow free entry of value and you want to allow search match on values like "East Mountain View" or "West Mountain View" when user inputs only "Mountain", then both wildcards are relevant.

    DataPigTech has quite a few tutorials you will probably find interesting.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Multi-Field Search Query not working
    By omair1051992 in forum Queries
    Replies: 16
    Last Post: 06-19-2012, 05:46 AM
  2. Multi-value Text Field Search
    By billfold in forum Queries
    Replies: 3
    Last Post: 04-30-2012, 03:43 PM
  3. Multi Field Combo search Form
    By Andyjones in forum Access
    Replies: 3
    Last Post: 03-12-2012, 02:13 PM
  4. Replies: 1
    Last Post: 12-16-2010, 10:32 AM
  5. Append Query - Multi-Valued Field
    By catat in forum Queries
    Replies: 0
    Last Post: 05-11-2010, 01:52 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