-
Hello
I am trying to covert one file to another and the file i am converting from has empty names and i don't want then in my new file so these are what i am using.
if trim(Len(cu.Name) = 0 then
if len(trim(cu.name) = 0 then
are these correct and if not how can i trim the spaces away and set the len to 0.
i have done this in the past but i just can not get it to work this time.
thanks for your help
-
You could try:
Code:
if strcomp(cu.name, space(len(cu.name)), vbtextcompare) = 0 then
I'm not positive that it works,
Paul Bousa
-
You don't say what problem you are having but you need at least to add another right parenthesis in the "code" you showed:
if trim(Len(cu.Name)) = 0 then
if len(trim(cu.name)) = 0 then
-
maybe with variables?
Code:
Y = " " <-3 spaces...but no name
Z = Trim(Y)
if Len(Z) = 0 then
Y = ""
end if
this sets Len(Y) = 0
hope this helps...
(not quite sure what your aiming to do)
-
Let's say cu.name = " " 'three spaces
trim(Len(cu.Name)) = 3 because len(cu.name) = 3: Trim(3) returns 3
len(trim(cu.name)) = 0 because trim(cu.name) = "": len("") = 0
so use len(trim(cu.name))