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

Passing variables to a sub routine...

Status
Not open for further replies.

CDNJungler

Programmer
Jul 16, 2002
11
CA
If I create a sub routine such as:
Sub MyColor()
If Field1 < 0 then
Response.Write (&quot;<font color='Red'>Field1</font>&quot;)
End Sub

Now I want to pass a variable to this sub so that I can substitute any value for field1, and just use the
call MyColor() instead of writing out the code over and over for different fields. Any help is welcomed and apprieciated. Thanks
 
Code:
Sub MyColor(myField)
 If myField < 0 then
   Response.Write &quot;<font color='Red'>&quot; & myField & &quot;</font>&quot;
End Sub

then just put your field name in the call to MyColor()

eg) Call MyColor(&quot;Field1&quot;) Tony
reddot.gif WIDTH=500 HEIGHT=2 VSPACE=3

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top