K
Ken Halley
How does one refer to a variable name using a variable within a variable
name??? For example, I want to perform a SQL query and use the results of
the query to determine which variable to assign a value to. Let's say I've
dimmed 12 variables based on the months called "featured_x_product" where x
is the month. I'd like to refer to the variable with something
like: featured_" & R("month") & "_product where R("month") is the from the
current row in the db. I don't know the correct syntax or method for doing
so. A full example is provided below. Thanks in advance for you help!
dim featured_jan_product
dim featured_feb_product
dim featured_mar_product
dim featured_apr_product
....
SELECT status, month from products where year='2004' AND
page='featured_products'
While not R.EOF
If R("status") = "sold" Then
featured_" & R("month") & "_product = "Sold Out!" // (choose the
variable based on the "month" value in the current row)
Else
featured_" & R("month") & "_product = "Buy Now!"
End If
R.MoveNext
Wend
name??? For example, I want to perform a SQL query and use the results of
the query to determine which variable to assign a value to. Let's say I've
dimmed 12 variables based on the months called "featured_x_product" where x
is the month. I'd like to refer to the variable with something
like: featured_" & R("month") & "_product where R("month") is the from the
current row in the db. I don't know the correct syntax or method for doing
so. A full example is provided below. Thanks in advance for you help!
dim featured_jan_product
dim featured_feb_product
dim featured_mar_product
dim featured_apr_product
....
SELECT status, month from products where year='2004' AND
page='featured_products'
While not R.EOF
If R("status") = "sold" Then
featured_" & R("month") & "_product = "Sold Out!" // (choose the
variable based on the "month" value in the current row)
Else
featured_" & R("month") & "_product = "Buy Now!"
End If
R.MoveNext
Wend