Invalid procedure call or argument: 'mid'

Hi, Can someone help me with this error...I started getting this error msg on a program that use to work fine without error, the error msg is "Invalid procedure call or argument: 'mid'
this is the code:
function GenerateBlanks(str)
dim i
dim result
result=""
for i=1 to len(str)
if (mid(str,i,1)="*") then
result= result & " "
else
result= result & mid(str,i,1)
end if
next
GenerateBlanks = result
end function

pos=instr(1,part1,"~")
fname=mid(part1,1,pos-1)
part1=mid(part1,pos+1)

The error comes on line with the code - fname=mid(part1,1,pos-1)

I need help


Comments

  • : Hi, Can someone help me with this error...I started getting this
    : error msg on a program that use to work fine without error, the
    : error msg is "Invalid procedure call or argument: 'mid'
    : this is the code:
    : function GenerateBlanks(str)
    : dim i
    : dim result
    : result=""
    : for i=1 to len(str)
    : if (mid(str,i,1)="*") then
    : result= result & " "
    : else
    : result= result & mid(str,i,1)
    : end if
    : next
    : GenerateBlanks = result
    : end function
    :
    : pos=instr(1,part1,"~")
    : fname=mid(part1,1,pos-1)
    : part1=mid(part1,pos+1)
    :
    : The error comes on line with the code - fname=mid(part1,1,pos-1)
    :
    : I need help
    :
    :
    :

    I suspect pos-1 is negative. Set a debugger breakpoint and run through the code to be sure.
    Best Regards,
    Richard

    The way I see it... Well, it's all pretty blurry
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion