[AccessD] A2K: Run a VBA Function whose name is stored in atable

Darren - Active Billing darren at activebilling.com.au
Sun Sep 13 20:18:33 CDT 2009


Hi Stuart - thanks for the quick reply

The function name returned is correct
EG say strFunctionToRun = "f_SomeCoolFunction"
I see this with a debug.print of strFunctionToRun
But when I apply it to CurrentDB.Execute strFunctionToRun

I get an error

"The Microsoft Jet database cannot find the input table or query
'f_SomeCoolFunction'. Make sure it exists and that the name is spelled
correctly"

Now if I copy and paste the debug.print results into the immediate window and
hit enter the function 'f_ SomeCoolFunction' runs as expected

Any suggestions?
 
Darren - Active Billing


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Stuart McLachlan
Sent: Monday, 14 September 2009 10:34 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] A2K: Run a VBA Function whose name is stored in atable

CurrentDB.Execute strFunctionToRun

-- 
Stuart

On 14 Sep 2009 at 10:10, Darren - Active Billing wrote:

> Hi Team
> 
>  
> 
> How do you 'run' a VBA function in my Access dB whose name is stored in a
table?
> 
>  
> 
> Say I have a table called tblFunctions with 3 fields 
> 
> Fieldnames are : FunctionID, IsToRun and FunctionName
> 
> The 1st Field = PK, 2nd field = Integer and 3rd = text
> 
>  
> 
> EG
> 
>  
> 
> Dim strFunctionToRun as string
> 
>  
> 
> strFunctionToRun = dlookup("[FunctionName]","tblFunctions", "IsToRun = -1")
> 
>  
> 
> Assume the results of strFunctionToRun is
say."f_SomeCoolFunctionThatDoesStuff"
> 
>  
> 
> How do I 'run' the results of strFunctionToRun??
> 
>  
> 
> IE how do I run "f_someCoolFunctionThatDoesStuff"
> 
>  
> 
> Many thanks in advance
> 
>  
> 
> DD
> 
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com


-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list