Create variable longer than 255 characters

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jl2886
    New Member
    • Mar 2007
    • 83

    Create variable longer than 255 characters

    I would like to create a text variable that has 255 characters. If it isn't posssible what other options do I have?
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    Originally posted by jl2886
    I would like to create a text variable that has 255 characters. If it isn't posssible what other options do I have?
    It is possible and what it is called is declaring a Variable as a Fixed Length String. Whatever spaces are not used within the Variable are padded:
    Code:
    Dim strYourVariable As String * 255
    strYourVariable = "Philadelphia"
    'Philadelphia consists of 12 Bytes while strYourVariable consist of 255 Bytes
    '(12 for Philadelphia and 243 'padded spaces')

    Code:
    Debug.Print Len(strYourVariable)      'will output 255
    NOTE: A Fixed Length String can contain 1 to approximately 64K (2^16) characters.

    Comment

    • kartikss
      New Member
      • Apr 2007
      • 25

      #3
      Hi,

      If you want to create text variable more than 255 characters then use memo instead of text it has 65535

      try this option it might work

      thanks & bye

      kartik

      Comment

      • missinglinq
        Recognized Expert Specialist
        • Nov 2006
        • 3533

        #4
        And exactly how would you Dim that variable, kartik?

        Comment

        • ADezii
          Recognized Expert Expert
          • Apr 2006
          • 8834

          #5
          Originally posted by kartikss
          Hi,

          If you want to create text variable more than 255 characters then use memo instead of text it has 65535

          try this option it might work

          thanks & bye

          kartik
          You cannot Declare a Variable as Type Memo - no such animal exists.

          Comment

          • jl2886
            New Member
            • Mar 2007
            • 83

            #6
            Thanks everyone, I just seperated the variable into a couple different ones.

            Comment

            • ADezii
              Recognized Expert Expert
              • Apr 2006
              • 8834

              #7
              Originally posted by jl2886
              Thanks everyone, I just seperated the variable into a couple different ones.
              Glad to help.

              Comment

              • kartikss
                New Member
                • Apr 2007
                • 25

                #8
                Originally posted by missinglinq
                And exactly how would you Dim that variable, kartik?
                You don't require dim option here. no coding required.

                simply create a table you need create field name next to field go to data type and select memo instead of text

                Thanks & Bye

                Kartik

                Comment

                • Rabbit
                  Recognized Expert MVP
                  • Jan 2007
                  • 12517

                  #9
                  Originally posted by kartikss
                  You don't require dim option here. no coding required.

                  simply create a table you need create field name next to field go to data type and select memo instead of text

                  Thanks & Bye

                  Kartik
                  You misunderstood what missinglinq was talking about. A variable is not the same thing as a field.

                  A variable is Dimmed through code and as such there is no Memo variable.

                  Comment

                  Working...