Queries and Like

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Steve

    Queries and Like

    Hello,

    I currently have a query that takes it's criteria from a form. All works
    well except when a name is mis-spelled in the database. My thought was to
    try to use the "like" command as part of the critera. My problem is that
    when I use it, it finds no records. Need a little help please.

    TIA
    Steve


  • PC Datasheet

    #2
    Re: Queries and Like

    Steve,

    You also want to use wildcards. A '?' represents any 1 character and a '*'
    represents one or more characters. They are used like this:

    Like "?" & "at" returns cat. eat, fat, hat, mat, ....
    Note that the expression only returns 3-letter words because '?' represents
    only 1 character!

    Like "*" & "at" cat, eat, fat, hat, mat, meat, what, ....
    Note that the expression here requires the words to end in 'at' but there
    can be any number of letters in front of 'at'

    Wildcards can also be used in the middle of an expression or at the end.

    Like "s" & "?" & "ar" will return scar, star, ...
    Like "s" & "*" & "ar" will return all words beginning with 's' and ending with
    'ar'

    Like "m" & "?" will return all two-letter words beginning with 'm', ma, me, mi
    Like "m" & "*" will return all words begimming with 'm'
    to contrast, me will be returmed as well as Massachusetts and Mississippi

    --
    PC Datasheet
    Your Resource For Help With Access, Excel And Word Applications
    resource@pcdata sheet.com



    "Steve" <steve@work.com > wrote in message news:c5mjhd$bte $1@news.netins. net...[color=blue]
    > Hello,
    >
    > I currently have a query that takes it's criteria from a form. All works
    > well except when a name is mis-spelled in the database. My thought was to
    > try to use the "like" command as part of the critera. My problem is that
    > when I use it, it finds no records. Need a little help please.
    >
    > TIA
    > Steve
    >
    >[/color]


    Comment

    • Steve

      #3
      Re: Queries and Like

      I tried the following criteria, Like [forms]![lookup]!["Last" & "*"], with
      no luck. Is it even possible use like in this context or am I chasing my
      tail? The information was helpful to me for the future, thank you.

      Steve


      "PC Datasheet" <spam@nospam.sp am> wrote in message
      news:j2Bfc.9600 $zj3.4521@newsr ead3.news.atl.e arthlink.net...[color=blue]
      > Steve,
      >
      > You also want to use wildcards. A '?' represents any 1 character and a '*'
      > represents one or more characters. They are used like this:
      >
      > Like "?" & "at" returns cat. eat, fat, hat, mat, ....
      > Note that the expression only returns 3-letter words because '?'[/color]
      represents[color=blue]
      > only 1 character!
      >
      > Like "*" & "at" cat, eat, fat, hat, mat, meat, what, ....
      > Note that the expression here requires the words to end in 'at' but[/color]
      there[color=blue]
      > can be any number of letters in front of 'at'
      >
      > Wildcards can also be used in the middle of an expression or at the end.
      >
      > Like "s" & "?" & "ar" will return scar, star, ...
      > Like "s" & "*" & "ar" will return all words beginning with 's' and ending[/color]
      with[color=blue]
      > 'ar'
      >
      > Like "m" & "?" will return all two-letter words beginning with 'm', ma,[/color]
      me, mi[color=blue]
      > Like "m" & "*" will return all words begimming with 'm'
      > to contrast, me will be returmed as well as Massachusetts and Mississippi
      >
      > --
      > PC Datasheet
      > Your Resource For Help With Access, Excel And Word Applications
      > resource@pcdata sheet.com
      > www.pcdatasheet.com
      >
      >
      > "Steve" <steve@work.com > wrote in message[/color]
      news:c5mjhd$bte $1@news.netins. net...[color=blue][color=green]
      > > Hello,
      > >
      > > I currently have a query that takes it's criteria from a form. All[/color][/color]
      works[color=blue][color=green]
      > > well except when a name is mis-spelled in the database. My thought was[/color][/color]
      to[color=blue][color=green]
      > > try to use the "like" command as part of the critera. My problem is that
      > > when I use it, it finds no records. Need a little help please.
      > >
      > > TIA
      > > Steve
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • Steve

        #4
        Re: Queries and Like

        I got it figured out. Thank you very much for the help. Your information
        gave me a direction.

        Steve

        "Steve" <steve@work.com > wrote in message
        news:c5mnr1$gme $1@news.netins. net...[color=blue]
        > I tried the following criteria, Like [forms]![lookup]!["Last" & "*"], with
        > no luck. Is it even possible use like in this context or am I chasing my
        > tail? The information was helpful to me for the future, thank you.
        >
        > Steve
        >
        >
        > "PC Datasheet" <spam@nospam.sp am> wrote in message
        > news:j2Bfc.9600 $zj3.4521@newsr ead3.news.atl.e arthlink.net...[color=green]
        > > Steve,
        > >
        > > You also want to use wildcards. A '?' represents any 1 character and a[/color][/color]
        '*'[color=blue][color=green]
        > > represents one or more characters. They are used like this:
        > >
        > > Like "?" & "at" returns cat. eat, fat, hat, mat, ....
        > > Note that the expression only returns 3-letter words because '?'[/color]
        > represents[color=green]
        > > only 1 character!
        > >
        > > Like "*" & "at" cat, eat, fat, hat, mat, meat, what, ....
        > > Note that the expression here requires the words to end in 'at' but[/color]
        > there[color=green]
        > > can be any number of letters in front of 'at'
        > >
        > > Wildcards can also be used in the middle of an expression or at the end.
        > >
        > > Like "s" & "?" & "ar" will return scar, star, ...
        > > Like "s" & "*" & "ar" will return all words beginning with 's' and[/color][/color]
        ending[color=blue]
        > with[color=green]
        > > 'ar'
        > >
        > > Like "m" & "?" will return all two-letter words beginning with 'm', ma,[/color]
        > me, mi[color=green]
        > > Like "m" & "*" will return all words begimming with 'm'
        > > to contrast, me will be returmed as well as Massachusetts and[/color][/color]
        Mississippi[color=blue][color=green]
        > >
        > > --
        > > PC Datasheet
        > > Your Resource For Help With Access, Excel And Word Applications
        > > resource@pcdata sheet.com
        > > www.pcdatasheet.com
        > >
        > >
        > > "Steve" <steve@work.com > wrote in message[/color]
        > news:c5mjhd$bte $1@news.netins. net...[color=green][color=darkred]
        > > > Hello,
        > > >
        > > > I currently have a query that takes it's criteria from a form. All[/color][/color]
        > works[color=green][color=darkred]
        > > > well except when a name is mis-spelled in the database. My thought was[/color][/color]
        > to[color=green][color=darkred]
        > > > try to use the "like" command as part of the critera. My problem is[/color][/color][/color]
        that[color=blue][color=green][color=darkred]
        > > > when I use it, it finds no records. Need a little help please.
        > > >
        > > > TIA
        > > > Steve
        > > >
        > > >[/color]
        > >
        > >[/color]
        >
        >[/color]


        Comment

        • PC Datasheet

          #5
          Re: Queries and Like


          "Steve" <steve@work.com > wrote in message news:c5mnr1$gme $1@news.netins. net...[color=blue]
          > I tried the following criteria, Like [forms]![lookup]!["Last" & "*"], with
          > no luck. Is it even possible use like in this context or am I chasing my
          > tail? The information was helpful to me for the future, thank you.
          >
          > Steve
          >
          >
          > "PC Datasheet" <spam@nospam.sp am> wrote in message
          > news:j2Bfc.9600 $zj3.4521@newsr ead3.news.atl.e arthlink.net...[color=green]
          > > Steve,
          > >
          > > You also want to use wildcards. A '?' represents any 1 character and a '*'
          > > represents one or more characters. They are used like this:
          > >
          > > Like "?" & "at" returns cat. eat, fat, hat, mat, ....
          > > Note that the expression only returns 3-letter words because '?'[/color]
          > represents[color=green]
          > > only 1 character!
          > >
          > > Like "*" & "at" cat, eat, fat, hat, mat, meat, what, ....
          > > Note that the expression here requires the words to end in 'at' but[/color]
          > there[color=green]
          > > can be any number of letters in front of 'at'
          > >
          > > Wildcards can also be used in the middle of an expression or at the end.
          > >
          > > Like "s" & "?" & "ar" will return scar, star, ...
          > > Like "s" & "*" & "ar" will return all words beginning with 's' and ending[/color]
          > with[color=green]
          > > 'ar'
          > >
          > > Like "m" & "?" will return all two-letter words beginning with 'm', ma,[/color]
          > me, mi[color=green]
          > > Like "m" & "*" will return all words begimming with 'm'
          > > to contrast, me will be returmed as well as Massachusetts and Mississippi
          > >
          > > --
          > > PC Datasheet
          > > Your Resource For Help With Access, Excel And Word Applications
          > > resource@pcdata sheet.com
          > > www.pcdatasheet.com
          > >
          > >
          > > "Steve" <steve@work.com > wrote in message[/color]
          > news:c5mjhd$bte $1@news.netins. net...[color=green][color=darkred]
          > > > Hello,
          > > >
          > > > I currently have a query that takes it's criteria from a form. All[/color][/color]
          > works[color=green][color=darkred]
          > > > well except when a name is mis-spelled in the database. My thought was[/color][/color]
          > to[color=green][color=darkred]
          > > > try to use the "like" command as part of the critera. My problem is that
          > > > when I use it, it finds no records. Need a little help please.
          > > >
          > > > TIA
          > > > Steve
          > > >
          > > >[/color]
          > >
          > >[/color]
          >
          >[/color]


          Comment

          • PC Datasheet

            #6
            Re: Queries and Like

            Steve,

            Your syntax is incorrect!

            Try:

            Like [forms]![lookup]![Last] & "*"

            Steve
            PC Datasheet


            "Steve" <steve@work.com > wrote in message news:c5mnr1$gme $1@news.netins. net...[color=blue]
            > I tried the following criteria, Like [forms]![lookup]!["Last" & "*"], with
            > no luck. Is it even possible use like in this context or am I chasing my
            > tail? The information was helpful to me for the future, thank you.
            >
            > Steve
            >
            >
            > "PC Datasheet" <spam@nospam.sp am> wrote in message
            > news:j2Bfc.9600 $zj3.4521@newsr ead3.news.atl.e arthlink.net...[color=green]
            > > Steve,
            > >
            > > You also want to use wildcards. A '?' represents any 1 character and a '*'
            > > represents one or more characters. They are used like this:
            > >
            > > Like "?" & "at" returns cat. eat, fat, hat, mat, ....
            > > Note that the expression only returns 3-letter words because '?'[/color]
            > represents[color=green]
            > > only 1 character!
            > >
            > > Like "*" & "at" cat, eat, fat, hat, mat, meat, what, ....
            > > Note that the expression here requires the words to end in 'at' but[/color]
            > there[color=green]
            > > can be any number of letters in front of 'at'
            > >
            > > Wildcards can also be used in the middle of an expression or at the end.
            > >
            > > Like "s" & "?" & "ar" will return scar, star, ...
            > > Like "s" & "*" & "ar" will return all words beginning with 's' and ending[/color]
            > with[color=green]
            > > 'ar'
            > >
            > > Like "m" & "?" will return all two-letter words beginning with 'm', ma,[/color]
            > me, mi[color=green]
            > > Like "m" & "*" will return all words begimming with 'm'
            > > to contrast, me will be returmed as well as Massachusetts and Mississippi
            > >
            > > --
            > > PC Datasheet
            > > Your Resource For Help With Access, Excel And Word Applications
            > > resource@pcdata sheet.com
            > > www.pcdatasheet.com
            > >
            > >
            > > "Steve" <steve@work.com > wrote in message[/color]
            > news:c5mjhd$bte $1@news.netins. net...[color=green][color=darkred]
            > > > Hello,
            > > >
            > > > I currently have a query that takes it's criteria from a form. All[/color][/color]
            > works[color=green][color=darkred]
            > > > well except when a name is mis-spelled in the database. My thought was[/color][/color]
            > to[color=green][color=darkred]
            > > > try to use the "like" command as part of the critera. My problem is that
            > > > when I use it, it finds no records. Need a little help please.
            > > >
            > > > TIA
            > > > Steve
            > > >
            > > >[/color]
            > >
            > >[/color]
            >
            >[/color]


            Comment

            Working...