In any programming language, there are 2 different kinds of strings.
A string literal is a literal string, and is denoted by enclosing a literal
string in double quotes. Example:
Response.Write "A Literal String" ' writes "A Literal String" to the
page
A string variable is a storage container for a string. Think of it as a box,
which you can reference by name. The box has a string inside it, and when
you refer to the name of the box (variable), you are actually referring to
what is inside the box. Example:
Dim s
s = "A Literal String"
Response.Write s ' writes "A Literal String" to the page
Note that the string variable is NOT enclosed in quotes. Why? Because it is
not a string literal. It is a variable HOLDING a string. The variable name
represents the string.
Now, what happens when you enclose the variabe name "s" in double quotes? It
becomes a string literal. Example:
Dim s
s = "A Literal String"
Response.Write "s" ' writes "s" to the page
Now, knowing that, let's look at your failed example:
Response.Write "<TD rowspan=2>" & objBU("Response.Write
Request.Form("Year")") & "</TD>"
Note that, according to the rules of VBScript, you enclosed "Response.Write
Request.Form("Year")" in double quotes. So, what does that indicate?:
Response.Write "<TD rowspan=2> & objBU("Response.Write
Request.Form("Year")") ...
So, what database column is being looked at? Apparently, one named
"Response.Write Request.Form("Year")"
- which wouldn't even parse correctly, because it is a string with more than
2 double-quotes in it, BTW.
So, how to correct the code? Something along the lines of:
Response.Write "<TD rowspan=2>" & objBU(Request.Form("Year")) & "</TD>"
Now, in order for the above code to work, you would have to have gone to a
page previously, which has a form in it, and the form would have to have a
field named "Year" in it. The form's ACTION property would point to the
current page, would have posted to the current page, and in the current
page, you would have to have opened a RecordSet, and there would have to be
a database COLUMN with the same NAME (not value) as the year that the user
entered in it.
This is very basic ASP stuff. If you plan to continue using ASP, you need to
have the basics down before you proceed.
--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.