• Searching a string for a specific character (A2K Sr1)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Searching a string for a specific character (A2K Sr1)

    Author
    Topic
    #364250

    Can someone tell me what code to use when looking at a string to tell me if a specific character exists in that string? Example: E-mail address. I want to look at the string to see if “@” exists and return a 1 or 0.

    Thanks,
    Mark Santos

    Viewing 0 reply threads
    Author
    Replies
    • #558479

      Something like this:

      Public Function bCkForAt(strAddress As String) As Boolean
          bCkForAt = InStr(strAddress, "@") > 0
      End Function
      
      • #558483

        I agree that what LegareColeman has submitted will work with “no problem” ………

        You can also do this without the need of a “User Defined” function by using an IIf statement:

        =IIf(InStr([FieldName],”@”)>0,1,0)

        RDH

    Viewing 0 reply threads
    Reply To: Searching a string for a specific character (A2K Sr1)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: