Jumat, 14 Agustus 2015

RE: [MS_AccessPros] calling function in vba

 


Maybe I did not explain well:

Currently I have this setup:

I have a macro 'mopen', the entry in the macro:
macro name 'dm' action 'run code'
function name=mm("Defintion Menu")

Currently I have a table with field '[button event]
![button event]=mopen.dm

when the button is selected , i triggers the following event:
DoCmd.RunMacro (![button event]) and then executes mm("Definition Menu") correctly.

I would like to eliminate the step of calling the 'mopen' macro and loading mm("Definition Menu") into the [button event] field and then running the function that is stored in [button event]. 
How do I / can I tell VBA to run the function that is store in [button event]?

Or do I just have to keep the 'mopen' macro to make this work.

Sarah


---In MS_Access_Professionals@yahoogroups.com, <duanehookom@...> wrote :

Sarah,
What is the code for the function mm()?
 
What is A?
Is rstMenu a recordset and [BUTTON EVENT] a field in that recordset?
Have you attempted to set a break point and step through your code?
Is the "{" just a typo in your email or is it in your code?
Could you share more of your code?
 
Duane Hookom, MVP
MS Access
 

To: MS_Access_Professionals@yahoogroups.com
From: MS_Access_Professionals@yahoogroups.com
Date: Thu, 13 Aug 2015 15:43:07 -0700
Subject: [MS_AccessPros] calling function in vba



i have a function 'mm'. I am trying to call this function with a variable from a table, it does not work, The exact same function works if I type the variable name directly into the statement. 


the following does not work, does not do anything. I tried with and without "()". does not make a difference
A = (rstmenu![BUTTON EVENT])
A = rstmenu![BUTTON EVENT]

The following works:
A = mm("Definition Menu")
 rstmenu!{button event] =mm("Definition Menu")
 
What am I doing wrong?
Sarah






__._,_.___

Posted by: sarahk@schemesoftware.com
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (3)

.

__,_._,___

Tidak ada komentar:

Posting Komentar