469,306 Members | 2,444 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,306 developers. It's quick & easy.

Create variable longer than 255 characters

83
I would like to create a text variable that has 255 characters. If it isn't posssible what other options do I have?
Apr 9 '07 #1
8 10765
ADezii
8,800 Expert 8TB
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:
Expand|Select|Wrap|Line Numbers
  1. Dim strYourVariable As String * 255
  2. strYourVariable = "Philadelphia"
'Philadelphia consists of 12 Bytes while strYourVariable consist of 255 Bytes
'(12 for Philadelphia and 243 'padded spaces')

Expand|Select|Wrap|Line Numbers
  1. Debug.Print Len(strYourVariable)      'will output 255
NOTE: A Fixed Length String can contain 1 to approximately 64K (2^16) characters.
Apr 9 '07 #2
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
Apr 10 '07 #3
missinglinq
3,532 Expert 2GB
And exactly how would you Dim that variable, kartik?
Apr 10 '07 #4
ADezii
8,800 Expert 8TB
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.
Apr 10 '07 #5
jl2886
83
Thanks everyone, I just seperated the variable into a couple different ones.
Apr 10 '07 #6
ADezii
8,800 Expert 8TB
Thanks everyone, I just seperated the variable into a couple different ones.
Glad to help.
Apr 10 '07 #7
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
Apr 13 '07 #8
Rabbit
12,516 Expert Mod 8TB
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.
Apr 13 '07 #9

Post your reply

Sign in to post your reply or Sign up for a free account.

By using this site, you agree to our Privacy Policy and Terms of Use.