Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Arlington, Texas, USA
    Posts
    124
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Checking for words in a field (Access 2003 SP2)

    I have a database where I imported data from another program. One of the fields (Keywords) is a memo field that contains various Keywords, separated by commas. I have added fields (yes/no) to the table that correspond with various Keywords in the memo field. I need to run an update query to check if a specific keyword exists in the memo field and if it does update the corresponding yes/no field to yes.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Checking for words in a field (Access 2003 SP2)

    1) You can use the inStr function to return True or False depending on whether a field contains a keyword, e.g.

    InStr([Keywords],"north")

    is True if the Keywords field contains the word north, otherwise False. Pleae be aware that if one keyword is part of another one, the result may not be what you expected, e.g. if Keywords contains "cafe, restaurant, hotel", InStr([Keywords], "rest") will be true. If the Keywords field has been filled very consistently, there are ways around this.

    2) I wouldn't use a Yes/No field for each keyword, since it leads to an inflexible structure - each time you need to add a keyword, you'd have to change the structure of the table. Instead, I'd use a separate table linked to the original one in which each keyword is a separate record.

  3. #3
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Arlington, Texas, USA
    Posts
    124
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Checking for words in a field (Access 2003 SP2)

    that was it thanks Hans, the field was always the same and no dupicate data

Posting Permissions

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