Invalid procedure call or argument: 'mid' - Programmers Heaven

Howdy, Stranger!

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

Categories

Invalid procedure call or argument: 'mid'

nitewriternitewriter Posts: 1Member
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

  • BitByBit_ThorBitByBit_Thor Posts: 2,444Member
    : 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.