Results 1 to 4 of 4
  1. #1
    Star Lounger
    Join Date
    Oct 2002
    Location
    Sheffield, Yorkshire, England
    Posts
    80
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Call a procedure using a variable (Access 2000)

    Is it possible to call a sub routine when the sub routine name is held within a string variable?

    I have a listbox with descriptions of tasks to perform. I want users to be able to double click on an item which will then call the appropriate routine from the listbox double click event.

    Any help or a workaround will be much appreciated.

    Grahamw

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Call a procedure using a variable (Access 2000)

    <!profile=MarkD>MarkD<!/profile> provided a good answer to this question in Post 203987.
    Charlotte

  3. #3
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Call a procedure using a variable (Access 2000)

    Here is another possible solution.

    Put all the procedures you want to run in a module, where they must all be defined as Public Functions. Your function names in your listbox must include the "( )" denoting a function (or you can add them later in your code). So, assuming the function is the bound column in your listbox, in your doubleclick event code all you need is:
    Eval lstProcedures

    If you want the function to return a value, just put Eval(lstProcedures) in your formula.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  4. #4
    Star Lounger
    Join Date
    Oct 2002
    Location
    Sheffield, Yorkshire, England
    Posts
    80
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Call a procedure using a variable (Access 2000)

    Thanks very much. It works a treat!

    Grahamw

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •