Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2002
    Location
    UK
    Posts
    1

    Unanswered: inserting and querying more than one value

    Please help!

    Is there a way of inserting more than one value into an Access Form Field and yet be able to search for just one of the values inserted?

    Example;
    TextBoxLabel is - Locations
    Textbox (input) is - London, Croydon, Brighton

    SQL Query is to search for any one of these values. When I search for Croydon on its own, I get no results. However, when I enter the whole string, I get a result. Do I need to separate each value?

    Thanks for your time.

    Anthony
    Last edited by anthony121; 10-04-02 at 07:45.

  2. #2
    Join Date
    Jun 2002
    Posts
    33

    Re: inserting and querying more than one value

    Hi Antony,
    You may try this: put the values from that textbox into an array and then search, in query, by the values from the array.

    Bye

    PS Let me know if this works !!
    PacuIonut

  3. #3
    Join Date
    Aug 2002
    Location
    Québec, Canada
    Posts
    109
    You can use a like operator in your SQL query:

    WHERE field1 Like "*Brooklyn*"


    These field will be returned:

    Brooklyn
    Brooklynn
    Brooklyn North
    The city of Brooklyn

    These will not

    Brooks
    The city of Brook-lyn
    Brooklynn


    The caracter * indicated "Any characters, or no character" so if your search Like "A*", you'll find all that start with the letter 'A'

    I suggest you use the array as already stated and one or more like operator


    JefB - hope it helps

  4. #4
    Join Date
    Sep 2002
    Location
    Coventry, Warwickshire, UK
    Posts
    74
    I assume that the text box is a bound control onto a column in a table. If that is correct, then you are breaking the rules of relational databases by having more than one result in a single field. Your tables should be normalised, which would solve your problem of querying the data.
    Roger Hampson
    XI - ecs (UK) Ltd

Posting Permissions

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