Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Access 2003- Help with Query to search a number of fields in db!!

  • 14-07-2011 04:57PM
    #1
    Registered Users, Registered Users 2 Posts: 45


    Hey,
    Would anyone be able to advise the best way to do the following.
    I have a table called clients- that contains the usual information ie client name, address fields, county, tel no etc. Am looking to create a query that searches all the address fields and locates the address word i type into the pop up box. any advise much appreciated


Comments

  • Registered Users, Registered Users 2 Posts: 1,456 ✭✭✭FSL


    SELECT whatever you want FROM your database table WHERE your search criteria matches.

    If you are searching for a word or phrase use LIKE.
    i.e. where field name LIKE '%your word/phrase%'

    The % at the beginning signifies the field can have anything before the selection criteria and the % at the end means the field can have any thing after the selection criteria.

    Either % can be omitted to determine how much other than the search criteria may be contained in the field.


  • Registered Users, Registered Users 2 Posts: 75 ✭✭1qTour


    SQL might look something like...

    SELECT COUNT(*) as NumRecords WHERE Address1 LIKE '%SearchWord%' OR Address2 LIKE '%SearchWord%' OR Address3 LIKE '%SearchWord%';

    The '%' wildcard might be '*' while using directly from access. This will return the number of records that match the search criteria not the actual records.


  • Registered Users, Registered Users 2 Posts: 45 E26


    Thanks a mill for the replies- got it sorted:)


Advertisement