[AccessD] Pseudo Pointer to a Function

A.D.Tejpal adtp at airtelmail.in
Wed Jul 1 08:55:04 CDT 2009


    This refers to my post of 27-Jun-2009, placed below. While response from William is awaited, it would be nice if other members of this forum could also kindly conduct a test and confirm whether any success with using CallByName() function where the called procedure / function is in a general module.

Best wishes,
A.D. Tejpal
------------

  ----- Original Message ----- 
  From: A.D.Tejpal 
  To: Access Developers discussion and problem solving 
  Sent: Saturday, June 27, 2009 11:07
  Subject: Re: [AccessD] Pseudo Pointer to a Function


  William,

      The test db is in Access 2000 file format running on Access 2003 installation. Converting it to Access 2003 file format does not make any difference.

      The called function and procedure are public. All the methods (Run, Eval and CallByName) require that the called function / procedure should be public (even if located within the module holding the calling code).

      Called function / procedure (public) - located in general module:
      (Error 438)
      ==========================================
      When public function / procedure located in a general module is called via CallByName function using the following syntax, it attracts error 438:

      CallByName Modules("<<ModuleName>>"),  _
                  "<<CalledProcName>>", VbMethod

      Note - The called procedure is a simple one - merely displaying a message.
      ==========================================

      Called function / procedure (public) - located in class module:
      (Works OK)
      ==========================================
      All the following statements are found to work smoothly:

      (a) Called proc is in the same form:
      CallByName Me, "<<CalledProcName>>", VbMethod

      (b) Called proc is in another form:
      CallByName Forms("<<FormName>>"),  _
                      "<<CalledProcName>>", VbMethod

      (c) Called proc is in a class:
      CallByName PointerToClassObject,  _
                      "<<CalledProcName>>", VbMethod
      ==========================================

  Best wishes,
  A.D. Tejpal
  ------------

    ----- Original Message ----- 
    From: William Hindman 
    To: Access Developers discussion and problem solving 
    Sent: Saturday, June 27, 2009 02:21
    Subject: Re: [AccessD] Pseudo Pointer to a Function


    A.D.

    ...are you using A2k3? ...is the function public?

    William

    --------------------------------------------------
    From: "A.D.Tejpal" <adtp at airtelmail.in>
    Sent: Thursday, June 25, 2009 5:27 AM
    To: "Access Developers discussion and problem solving" 
    <accessd at databaseadvisors.com>
    Subject: Re: [AccessD] Pseudo Pointer to a Function

    > William,
    >
    >    It appears that the procedure / function called by CallByName() 
    > function has to be in a class module. Could you kindly verify again 
    > whether it works successfully for procedures / functions contained in 
    > general modules ?
    >
    >    I am getting error 438 in such a case.
    >
    > Best wishes,
    > A.D. Tejpal
    > ------------
    >
    >  ----- Original Message ----- 
    >  From: William Hindman
    >  To: Access Developers discussion and problem solving
    >  Sent: Tuesday, June 23, 2009 23:21
    >  Subject: Re: [AccessD] Pseudo Pointer to a Function
    >
    >  Arthur
    >
    >  ...from my treeview menu I use either of the following in a select 
    > statement
    >              'call a function from a module, "strObjectName" is from my
    >  tblSwitchboard
    >              CallByName modules("mdlMenuFunctions"), strObjectName, 
    > VbMethod
    >
    >              'call a sub from the switchboard form module itself
    >              CallByName CodeContextObject, strObjectName, VbMethod,
    >  strObjectAddtnl
    >
    >  ...hth
    >  William


More information about the AccessD mailing list