How to Obtain a Variable value by specifying the variable name using a form request

an example

Dim a
Dim b
Dim requested

a = "12345"
b = "67890"

 request.form("variable") = "a"
the form meant to specify that the variable i will use is a
now i need to include whats in var a in var Requested

how can i get requested = "12345" or "67890" using the from request either by a or b
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

r u writing an ASP application or a vb application...

request.form comes only in asp pages...

if u want to pass a value from one asp page to another asp page, u should use hidden fields in the html page and send the values....


If you're writing a windows program, just declare your variables as a public. Then you can call them like : formName.variable
If you declare the variable as Public in a form or class module, the you can use CallByName to refer to the variable by its name.

Public a As Long

Private Sub Command1_Click()

    'assign the value 12345 to Public variable "a"
    CallByName Me, "a", VbLet, 12345
    'read the value from Public variable called "a"
    MsgBox CallByName(Me, "a", VbGet)

End Sub

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
NabilbahrAuthor Commented:
if i will assign the variable as public , it will share the value with all the users
is there is any way to avoid assigning the variable as public
As far as I know, the only way to refer to a variable by its name during runtime is to declare it public.  It then acts just like a property of the module.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.