Chr function

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

    #1

    Chr function

    I am working as an intern at a place using Access 2003 code builder.

    Looking at the cold of the old project t(hat we are redoing), I see
    Chr(39)

    Chr(91)

    Chr(45)

    Chr(93)

    Chr(42)


    An example is this:

    strCriteria = (strCriteria & tableColumnName & " LIKE " & Chr(39) &
    Chr(42 & )vSearchValue & Chr(42) & Chr(39)


    I have no books or resource to use - have no VBA or VB.net installed in
    my PC; Can anyone tells me what each of these functions returns?

  • me

    #2
    Re: Chr function

    BTW, I tried the following (in access) to see what Chr (39) gives but
    it gives erroe message.

    Private Sub btntest_Click()
    Dim strReturn1 As String
    strReturn1 = Chr(39)
    Form!label1 = strReturn1

    Dim strReturn2 As String
    strReturn2 = Chr(91)
    Form!label2 = strReturn2

    End Sub

    Is there any way I can test (in Access) to see what Chr(39) gives?

    Comment

    • fredg

      #3
      Re: Chr function

      On 21 Jul 2006 16:05:03 -0700, me wrote:
      I am working as an intern at a place using Access 2003 code builder.
      >
      Looking at the cold of the old project t(hat we are redoing), I see
      Chr(39)
      >
      Chr(91)
      >
      Chr(45)
      >
      Chr(93)
      >
      Chr(42)
      >
      An example is this:
      >
      strCriteria = (strCriteria & tableColumnName & " LIKE " & Chr(39) &
      Chr(42 & )vSearchValue & Chr(42) & Chr(39)
      >
      I have no books or resource to use - have no VBA or VB.net installed in
      my PC; Can anyone tells me what each of these functions returns?
      Here is how you can find out for yourself what the chr() values are.
      Open any VBA code window (i.e. Ctrl + G).
      Click on Help.
      Select the Index tab.
      Type
      ASCII
      in the Type Keyword box
      Click on Search
      Then select
      Character Set (0 ¡V 127)
      in the Choose a Topic box
      and read all of the chr values.
      For instance, =chr(91) is the close bracket ( ] ) symbol,
      = chr(45) is the hyphen ( - ).

      --
      Fred
      Please respond only to this newsgroup.
      I do not reply to personal e-mail

      Comment

      • ADezii
        Recognized Expert Expert
        • Apr 2006
        • 8834

        #4
        Originally posted by me
        I am working as an intern at a place using Access 2003 code builder.

        Looking at the cold of the old project t(hat we are redoing), I see
        Chr(39)

        Chr(91)

        Chr(45)

        Chr(93)

        Chr(42)


        An example is this:

        strCriteria = (strCriteria & tableColumnName & " LIKE " & Chr(39) &
        Chr(42 & )vSearchValue & Chr(42) & Chr(39)


        I have no books or resource to use - have no VBA or VB.net installed in
        my PC; Can anyone tells me what each of these functions returns?
        'To find out what all these codes mean simply execute this code within any
        'Event (in this case the Click of a Command Button) and view the
        'contents of the Immediate Window


        Private Sub Command27_Click ()
        On Error Resume Next

        Dim intCounter As Integer

        For intCounter = 1 To 255
        Debug.Print "Chr(" & Trim(Str(intCou nter)) & ") is equivalent to: " & Chr(intCounter)
        Next intCounter

        End Sub

        Comment

        • fredg

          #5
          Re: Chr function

          On 21 Jul 2006 16:37:15 -0700, me wrote:
          BTW, I tried the following (in access) to see what Chr (39) gives but
          it gives erroe message.
          >
          Private Sub btntest_Click()
          Dim strReturn1 As String
          strReturn1 = Chr(39)
          Form!label1 = strReturn1
          >
          Dim strReturn2 As String
          strReturn2 = Chr(91)
          Form!label2 = strReturn2
          >
          End Sub
          >
          Is there any way I can test (in Access) to see what Chr(39) gives?
          Open the debug window (Ctrl + G)
          Type
          ?chr(39)
          the character result will appear beneath it
          ' (the apostrophe)

          If you know the character and want to find it's AscII value, type the
          character within double quotes.
          ?Asc("'")
          The value will appear beneath it:
          39
          See my previous reply to your first post for more information.

          --
          Fred
          Please respond only to this newsgroup.
          I do not reply to personal e-mail

          Comment

          • me

            #6
            Re: Chr function


            fredg

            Thanks a lot.

            Comment

            • Randy Harris

              #7
              Re: Chr function

              * fredg:
              On 21 Jul 2006 16:37:15 -0700, me wrote:
              >
              >BTW, I tried the following (in access) to see what Chr (39) gives but
              >it gives erroe message.
              >>
              >Private Sub btntest_Click()
              >Dim strReturn1 As String
              >strReturn1 = Chr(39)
              >Form!label1 = strReturn1
              >>
              >Dim strReturn2 As String
              >strReturn2 = Chr(91)
              >Form!label2 = strReturn2
              >>
              >End Sub
              >>
              >Is there any way I can test (in Access) to see what Chr(39) gives?
              >
              Open the debug window (Ctrl + G)
              Type
              ?chr(39)
              the character result will appear beneath it
              ' (the apostrophe)
              >
              If you know the character and want to find it's AscII value, type the
              character within double quotes.
              ?Asc("'")
              The value will appear beneath it:
              39
              See my previous reply to your first post for more information.
              >
              Excellent response. Rather than providing only the values, how the OP
              can get them for himself. Give a man a fish...

              Comment

              • Nick 'The Database Guy'

                #8
                Re: Chr function

                Chr(39) = '


                Chr(91) = [


                Chr(45) = -


                Chr(93) = ]


                Chr(42) = *

                Hope this solves your problem.

                Good luck

                Nick

                me wrote:
                I am working as an intern at a place using Access 2003 code builder.
                >
                Looking at the cold of the old project t(hat we are redoing), I see
                Chr(39)
                >
                Chr(91)
                >
                Chr(45)
                >
                Chr(93)
                >
                Chr(42)
                >
                >
                An example is this:
                >
                strCriteria = (strCriteria & tableColumnName & " LIKE " & Chr(39) &
                Chr(42 & )vSearchValue & Chr(42) & Chr(39)
                >
                >
                I have no books or resource to use - have no VBA or VB.net installed in
                my PC; Can anyone tells me what each of these functions returns?

                Comment

                • Terry Kreft

                  #9
                  Re: Chr function

                  .... and he'll smell for a day (?)

                  --

                  Terry Kreft


                  "Randy Harris" <please@send.no .spamwrote in message
                  news:ecgwg.1294 65$H71.44537@ne wssvr13.news.pr odigy.com...
                  * fredg:
                  On 21 Jul 2006 16:37:15 -0700, me wrote:
                  BTW, I tried the following (in access) to see what Chr (39) gives but
                  it gives erroe message.
                  >
                  Private Sub btntest_Click()
                  Dim strReturn1 As String
                  strReturn1 = Chr(39)
                  Form!label1 = strReturn1
                  >
                  Dim strReturn2 As String
                  strReturn2 = Chr(91)
                  Form!label2 = strReturn2
                  >
                  End Sub
                  >
                  Is there any way I can test (in Access) to see what Chr(39) gives?
                  Open the debug window (Ctrl + G)
                  Type
                  ?chr(39)
                  the character result will appear beneath it
                  ' (the apostrophe)

                  If you know the character and want to find it's AscII value, type the
                  character within double quotes.
                  ?Asc("'")
                  The value will appear beneath it:
                  39
                  See my previous reply to your first post for more information.
                  >
                  Excellent response. Rather than providing only the values, how the OP
                  can get them for himself. Give a man a fish...
                  >

                  Comment

                  • me

                    #10
                    Re: Chr function


                    Nick 'The Database Guy' wrote:
                    Chr(39) = '
                    >
                    >
                    Chr(91) = [
                    >
                    >
                    Chr(45) = -
                    >
                    >
                    Chr(93) = ]
                    >
                    >
                    Chr(42) = *
                    >
                    Hope this solves your problem.
                    >
                    Good luck
                    >
                    Nick
                    Thanks.

                    I didn't work yesterday and am about to go find out what those
                    functiosn are returning and decided to check this thread again. Saves
                    me some time.



                    >
                    me wrote:
                    I am working as an intern at a place using Access 2003 code builder.

                    Looking at the cold of the old project t(hat we are redoing), I see
                    Chr(39)

                    Chr(91)

                    Chr(45)

                    Chr(93)

                    Chr(42)


                    An example is this:

                    strCriteria = (strCriteria & tableColumnName & " LIKE " & Chr(39) &
                    Chr(42 & )vSearchValue & Chr(42) & Chr(39)


                    I have no books or resource to use - have no VBA or VB.net installed in
                    my PC; Can anyone tells me what each of these functions returns?

                    Comment

                    Working...