469,326 Members | 1,607 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,326 developers. It's quick & easy.

Dynamic Variables

1
I need to create a set of variables that I can reference for some formulas (var1 + var2, etc) later on in the page. The data is being pulled from a db - the variable name and the value of the variable. I am having a hard time setting the value of the variable and then being able to reference it for display or the formulas.

do until subs.eof

thisvar = thisvar & "val_" & subs("acctname")


thisvar = subs("amount")


subs.movenext
loop

subs.close
set subs=nothing

Basically "thisvar" has become the value so instead of being able to do <%=(val_ADV)%>, I just nothing because that variable has gone away. I am sure I am overlooking something simple. Help would be SO appreciated!
Apr 1 '07 #1
1 1066
jhardman
3,406 Expert 2GB
I need to create a set of variables that I can reference for some formulas (var1 + var2, etc) later on in the page. The data is being pulled from a db - the variable name and the value of the variable. I am having a hard time setting the value of the variable and then being able to reference it for display or the formulas.

do until subs.eof

thisvar = thisvar & "val_" & subs("acctname")


thisvar = subs("amount")


subs.movenext
loop

subs.close
set subs=nothing

Basically "thisvar" has become the value so instead of being able to do <%=(val_ADV)%>, I just nothing because that variable has gone away. I am sure I am overlooking something simple. Help would be SO appreciated!
He, he, he. Silly mistake. Try:
Expand|Select|Wrap|Line Numbers
  1. do  until subs.eof
  2.  
  3.     thisvar = thisvar & "val_" & subs("acctname")
  4.  
  5.  
  6.     thisvar = thisvar & subs("amount")
  7.  
  8.  
  9.     subs.movenext
  10. loop
Let me know if it helps.

Jared
Apr 2 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Tommy Lang | last post: by
1 post views Thread by Nathan Bloomfield | last post: by
12 posts views Thread by scott | last post: by
2 posts views Thread by deejayquai | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by Gurmeet2796 | last post: by
reply views Thread by listenups61195 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.