Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6145653
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:49:35+00:00 2026-05-23T18:49:35+00:00

I have a variable strFunction , then I have another string strName = strFunction

  • 0

I have a variable strFunction, then I have another string strName = "strFunction" , what I want to know is how can I get the value of strFunction by using strName.

For example, something like getValue(strName) gives me the value of strFunction. Is it possible in Access VBA?

Thanks!

EDIT:

I have a strFunction string, it’s a const string.
In my code I want to use Len("strFunction") to test the length of it, but what i got is the length “strFunction”. So I need a get-value-out-of-variable-name function. I have tried Eval(), but it cannot do this, even I write a get_strFunction(), eval("get_strFunction()") gives me error, telling me it cannot find it.

Private Const strFunction as String = "FilterByType_1"
Private Function get_strFunction()
    get_strFunction = strFunction
End Function
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T18:49:35+00:00Added an answer on May 23, 2026 at 6:49 pm

    “I have a variable strFunction, then I have another string strName = “strFunction” , what I want to know is how can I get the value of strFunction by using strName.“

    Instead of a variable, strFunction could be the key for an item in a VBA collection.

    Public Sub darkjh()
        Dim strName As String
        Dim col As Collection
        Set col = New Collection
        col.Add "FilterByType_1", "strFunction"
        strName = "strFunction"
        Debug.Print col(strName)
        Set col = Nothing
    End Sub
    

    Edit: Instead of a VBA collection, you could use a Scripting.Dictionary.

    Dim strName As String
    Dim dict As Object
    Set dict = CreateObject("Scripting.Dictionary")
    dict.Add "strFunction", "FilterByType_1"
    strName = "strFunction"
    Debug.Print dict(strName)
    Set dict = Nothing
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a variable of type Hashmap <String,Integer >. In this, the Integer value
I want a two-column div layout, where each one can have variable width e.g.
I have variable in tpl file as {assign var=por value=$product.productid} How can I use
I have variable that get's value of checked radio button named: parentcheck I wanna
i have this code , i want to convert the get(title) to variable ,
If I have variable of type IEnumerable<List<string>> is there a LINQ statement or lambda
How I can have variable number of parameters in my function in C++. Analog
I have a variable of type Dynamic and I know for sure one of
I have a variable that is built in loop. Something like: $str = ;
I have a variable last_login and want to output a message if the last

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.