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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help needed with Function

Status
Not open for further replies.

SuperCyber

Programmer
Aug 10, 2001
35
US
What am I missing here? Im at a loss. Any help is appreciated.

Thanks,
Brian

Function custInfo2(Address1,Address2,Apt1,Apt2)
Dim Ap1, Ap2
If Apt1 <> &quot;&quot; Then
Ap1 = &quot; Apt. &quot; & Apt1
Else
Ap1 = &quot;&quot;
End If
If Apt2 <> &quot;&quot; Then
Ap2 = &quot; Apt. &quot; & Apt2
Else
Ap2 = &quot;&quot;
End If

Response.Write &quot;<select name='Address' id='Address'>&quot;
Response.Write &quot;<option value='1' Selected>&quot; & Address1
Response.Write Ap1
Response.Write &quot;</option>&quot;
Response.Write &quot;<option value='2'>&quot; & Address2
Response.Write Ap2
Response.Write &quot;</option></select>&quot;
End Function
 
Looks OK to me at first glance.
What's going wrong?? Mise Le Meas,

Mighty :)
 
The else statement is useless
If Apt1 <> &quot;&quot; Then ' true if APT1 is anything but &quot;&quot;
Ap1 = &quot; Apt. &quot; & Apt1
Else ' this means that Apt1 was allready &quot;&quot;
Ap1 = &quot;&quot;
end if

There is nothing else wrong with the function as I can see.
If it does not write the select box then you should check if there is any response.end after a response.end you cannot write anything anymore.
 
How are you calling the Function? Can you show us that code? And if it's embedded in an If statement, show that too, or at least review it yourself to see it's getting to that point.

And where you don't seem to be returning any value(s) from your function, you'd be just as well off to call it a Subroutine. Not sure of any pros or cons between the two, we just use Functions when we need to return a value from it.



 
This is the ELSEIF Statement I am using to call the Function.
Thanks again,
Brian
<%If ((Address1 = Address2) AND (Apt1 = Apt2)) Then%>
<%call custInfo1(Address1,Apt1)%>

<%ElseIF ((Address1 = Address2) AND (Apt1 <> Apt2)) Then%>
<%call custInfo2(Address1,Address2,Apt1,Apt2)%>

<%ElseIF ((Address1 <> Address2) AND (Apt1 <> Apt2)) Then%>
<%call custInfo2(Address1,Address2,Apt1,Apt2)%>

<%ElseIF ((Address1 <> Address2) AND (Apt1 = Apt2)) Then%>
<%call custInfo2(Address1,Address2,Apt1,Apt2)%>

<%End If%>
 
We still don't know what problem you are having. What is or isn't happening?? Mise Le Meas,

Mighty :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top