Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2002
    Location
    London
    Posts
    73

    Unanswered: Not Like in querys

    Hi,

    I just have a simple query in MS Access.

    I'm trying to show records which does not include a field name and the rest. For example if the in the Field called Surname i did not want to show anything with SH then i would do not like SH*. But i have another field from another table called Initials and i do not want to show anything from Initials field in the Surname field. Eg Not like [Initials]&"*" this does nor seem to work, i do not know why. If i do like [initials]&"*" then this will work. Can you please help me with the Not like pease.

    Thanks in advance

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    you need quotes
    Code:
    where Surname not like 'SH*'
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Jan 2002
    Location
    London
    Posts
    73
    Hi i did try

    WHERE (((Surname) Not Like ' [Initials] *') and it did not work, do you have any other ideas please.

  4. #4
    Join Date
    Jul 2006
    Posts
    108
    lets assume that the field initials is in the table called 'Thattable'

    Code:
    WHERE SURNAME NOT LIKE [THATTABLE].[INITIALS] & '*'
    i dont have access up so im thiniking that would work.

  5. #5
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    If [Initials] is a variable then try this.
    Let me know if you don't understand the below!
    Code:
    "WHERE Surname Not Like '" & [Initials] & "*'"
    George
    Home | Blog

Posting Permissions

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