Need help with error message

Results 1 to 2 of 2

Thread: Need help with error message

  1. #1
    Join Date
    Dec 1969

    Default Need help with error message

    Any ideas on how to fix this error?<BR><BR>Microsoft VBScript runtime error &#039;800a0005&#039; <BR><BR>Invalid procedure call or argument: &#039;Mid&#039; <BR><BR>/INST5735-01/OkaforJrE4836/Lesson6/lesson6c.asp, line 26 <BR><BR>&#060;body&#062;<BR>&#060;%<BR>Dim strPath,objFileSys, objTxtFile, strbmonth, strbday, strbrd, icounter, strLine, iLength, <BR><BR>icomma, ibdate, ibdate2, arrnames(30,5),iDash1, iDash2<BR><BR>strPath = Server.MapPath("birthday.txt")<BR>Set objFileSys = CreateObject("Scripting.FileSystemObject")<BR>Set objTxtFile = objFileSys.OpenTextFile(strPath,1,0)<BR>strbmonth= Request.form("month")<BR>strbday=Request.form("day ")<BR>strbrd=strbrmonth + "-" + strbrday + "-88"<BR>iCounter = 0<BR><BR>Do Until objTxtFile.AtEndOfStream<BR> strLine = objTxtFile.ReadLine<BR> If strLine = "" Then Exit Do<BR> iCounter = iCounter + 1<BR> iLength = Len(strLine)<BR> iComma = InStr(strLine,",")<BR> ibdate=iLength-(icomma+1)<BR> ibdate2=right(strLine,ibdate) <BR> arrNames(iCounter,1) = Left(strLine,iComma - 1)<BR> iDash1=InStr(ibdate,"-")<BR> arrNames(iCounter,2) = Right(strLine, iLength - iComma) <BR> arrNames(iCounter,3) = Mid(strLine,iComma+1,iDash1-1-iComma+1)<BR> iDash2 = InStr(iDash1+1,"-")<BR> arrNames(icounter,4) = Mid(strLine,iDash1+1,iDash2-1-iDash1+1)<BR> arrNames(icounter,5) = Right(strLine,2)<BR> <BR>Loop<BR><BR>objTxtFile.Close<BR>For iCounter2 = 1 to iCounter<BR><BR>If arrNames(iCounter2,3) = strbmonth And arrNames(icounter2,4)=strbday Then <BR> Response.Write arrNames(icounter2,1) & "has a birthday on this date<BR>"<BR> Response.write "Other birthdays this month are:<BR>"<BR>ElseIf arrNames(icounter2,2)=strbmonth Then<BR> Response.write arrNames(icounter2, 1) & "," & arrnames(icounter2, 2) <BR> Response.End<BR>End If<BR><BR> Next<BR><BR><BR>%&#062;<BR><BR>&#060;/body&#062;<BR>&#060;/html&#062; <BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Need help with error message

    Is it possible that you are calling Mid() on an empty string? I thought that would have returned a Type Mismatch error, but output/Debug Mid(strLine,iComma+1,iDash1-1-iComma+1) to see what you get. If nothing or error, remove the Mid() function and output each piece separately to see what values they contain.<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts