Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2003

    Wink Unanswered: Is there a way to replicate RunCode from a macro

    I would like to be able to run a particular function without explicitly calling it in code (i.e. a=MyFunction(varA,varB) )

    Background: I have a table that lists "events" and various "tasks" related to that event. In code, I would like to be able to look up each of those tasks, which are actually Functions, and run each one--basically a crude batch process.

    within a recordset...

    'sTask is a string ="MyFunction(varA,varB)"

    DoCmd.RunCode sTask

    However, there apparently is no DoCmd.RunCode available, but in macros, one can select RunCode and specifiy a function to run.

  2. #2
    Join Date
    Nov 2007
    Adelaide, South Australia
    Call is effectively DoCmd.RunCode so that might do it...

    You might also like to look at the Eval() function, it might help.

    I keep saying might because I have never done such a thing

    Why not use a select case statement in the code instead of storing the function name in a table?
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!

    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

Posting Permissions

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