Got strange Access project, where found this line:
strUserName = String$(39, 0)
What String$ means?
Got strange Access project, where found this line:
strUserName = String$(39, 0)
What String$ means?
What String$ means?
String$() means almost the same as String(), but String() can accept and return a Variant and String$() can not.
For example, String() will accept Null for the character argument and return Null ...
? String(5, Null)
Null
But substituting String$() for String() triggers error 94, "Invalid use of Null" ...
? String$(5, Null)
Regarding your example ... String$(39, 0) ... that returns a string of 39 null-byte characters (Chr(0)), which is not the same as Null.
It's an inbuilt function, normally used without the $:
String(number, character)
It returns a string with <number> characters.
E.g. String(5, "A") -> AAAAA
Apparently you can also use the Ascii code for character, so your example returns 39 * Chr(0).
string means a string of length x of character y, so string (5,33)="!!!!!", thats 39 chr(0)'s