Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sub or Function not defined 1

Status
Not open for further replies.

jessedh

MIS
Apr 16, 2002
96
US
I have the code below which executes perfectly until I added the if... then... end if statement.

Am I just missing something, can I not execute an IF in a recordset loop?

This is the error I am getting:
Microsoft VBScript runtime (0x800A0023)
Sub or Function not defined
/costcenter_Table1.asp, line 108



<%
'______________________________
'Loop thru the records for top of page summary calcs

do While not RS.EOF

CurrentStatus = rs.fields.item(&quot;CurrentStatus&quot;).Value

If CurrentStatus like &quot;*with*&quot; Then
withSum = withSum + RS.Fields.Item(&quot;NoteAmount&quot;).Value
Elseif CurrentStatus like &quot;*den*&quot; Then
denSum = denSum + RS.Fields.Item(&quot;NoteAmount&quot;).Value
Else
closedSum = closedSum + RS.Fields.Item(&quot;NoteAmount&quot;).Value
End If

RS.MoveNext

Loop

'jump back to the first record so that the loop can execute again
Rs.MoveFirst

'______________________________
%>
 
Like is not a sub or function in VBScript. You could do something like:
Code:
If InStr(lcase(CurrentStatus),&quot;like&quot;) > 0 Then

Which basically says if you find this word in CurrentStatus then continue. InStr only returns a position of 0 when it doesn't find the second string in the first.

-Tarwn

01010100 01101001 01100101 01110010 01101110 01101111 01101011 00101110 01100011 01101111 01101101
29 3K 10 3D 3L 3J 3K 10 32 35 10 3E 39 33 35 10 3K 3F 10 38 31 3M 35 10 36 3I 35 35 10 3K 39 3D 35 10 1Q 19
Do you know how hot your computer is running at home? I do
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top