match case

Discussion in 'Microsoft Access Form Coding' started by Sam, Feb 6, 2010.

  1. Sam

    Sam Guest

    I have two string expressions, A and B, that I would like to check for case
    match.
    In my code I have

    If A=B Then
    do something
    End If

    I need for the comparison to be case sensitive. How can I do that?
    Thanks so much!
    Sam
     
    Sam, Feb 6, 2010
    #1
    1. Advertisements

  2. If StrComp(A, B, vbBinary) = 0 Then
    do something
    End If

    --
    Doug Steele, Microsoft Access MVP
    http://I.Am/DougSteele
    (no e-mails, please!)



    "Sam" <> wrote in message
    news:...
    >I have two string expressions, A and B, that I would like to check for case
    > match.
    > In my code I have
    >
    > If A=B Then
    > do something
    > End If
    >
    > I need for the comparison to be case sensitive. How can I do that?
    > Thanks so much!
    > Sam
     
    Douglas J. Steele, Feb 6, 2010
    #2
    1. Advertisements

  3. On Sat, 6 Feb 2010 07:33:01 -0800, Sam <> wrote:

    >I have two string expressions, A and B, that I would like to check for case
    >match.
    >In my code I have
    >
    > If A=B Then
    > do something
    > End If
    >
    >I need for the comparison to be case sensitive. How can I do that?
    >Thanks so much!
    >Sam


    Use the builtin StrComp() function:

    If StrComp(A, B, vbBinaryCompare) = 0 Then

    --

    John W. Vinson [MVP]
     
    John W. Vinson, Feb 6, 2010
    #3
  4. On Sat, 06 Feb 2010 22:32:32 GMT, "Linq Adams via AccessMonster.com"
    <u28780@uwe> wrote:

    >If you wanted ***all comparisons*** in your form to be Case Sensitive, at the
    >top of your code module you could replace
    >
    >Option Compare Database
    >
    >with
    >
    >Option Compare Binary


    Linq, won't that just make VBA comparisons case sensitive? My understanding is
    that Queries will still be insensitive to case.
    --

    John W. Vinson [MVP]
     
    John W. Vinson, Feb 6, 2010
    #4
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Adam
    Replies:
    1
    Views:
    609
    John Vinson
    Jun 30, 2003
  2. Mota

    Using logical operators in a Select Case Statement

    Mota, Jul 4, 2003, in forum: Microsoft Access Form Coding
    Replies:
    3
    Views:
    12,064
    Marshall Barton
    Jul 4, 2003
  3. BruceM

    Match case on password confirmation

    BruceM, Apr 30, 2007, in forum: Microsoft Access Form Coding
    Replies:
    2
    Views:
    180
    BruceM
    Apr 30, 2007
  4. JohnE

    lower case / upper case

    JohnE, Oct 6, 2009, in forum: Microsoft Access Form Coding
    Replies:
    1
    Views:
    146
    John W. Vinson
    Oct 6, 2009
  5. Replies:
    0
    Views:
    635
Loading...

Share This Page