Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 169
  • Last Modified:

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
1 Solution
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
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.

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now