You can declare a fixed length as:
Dim s As String * 20
However, with modern systems, I can think of NO reason to use fixed length
strings
(about the ONLY exception I can think of is for custom export routines, and
even that is stretching it)
Those fixed length strings are really only there for compatibility with VERY
VERY old BASIC code.
Further, why use a fixed length one? They do NOT run faster, they do NOT
save memory, and really don't do anything for you except let old COBOL
programmers, and few others from 20 years ago work with fixed length string
variables, of which we now don't care about, and don't need.
What happens when this is processed...
Dim MyString As String
Am I getting VLS declaration or a FLS declaration?
You are getting a variable length one.
Can I control which I get somehow?
You can, but do you really need to?
There is a good number of string functions that you can use to pad, or add
spaces.
I mean, just make a handy global function to pad strings. You can use:
Public Function MyPad(s As String, intSize As Integer) As String
MyPad = Format(s, "!" & String(intSize, "@"))
End Function
Now, anywhere in code, you can go:
mypad("abc",20)
The above expression would return the string of "abc", but padded to 20
chars long
So, even for a custom export routine, I don't see the need to declare fixed
length strings.
For input processing, I see even LESS need for fixed length strings.
Perhaps you might expand on why, or what the reasons here are for needing
fixed length strings, but I am at a loss here as why you need a fixed length
variable?
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com http://www.members.shaw.ca/AlbertKallal