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

Posted on 2005-03-13
Medium Priority
Last Modified: 2010-05-02
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
Question by:Nabilbahr
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 13532605
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....


LVL 53

Expert Comment

ID: 13532643
If you're writing a windows program, just declare your variables as a public. Then you can call them like : formName.variable
LVL 32

Accepted Solution

Erick37 earned 750 total points
ID: 13534431
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

Author Comment

ID: 13540046
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
LVL 32

Expert Comment

ID: 13540375
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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month12 days, 18 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question