• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 358
  • Last Modified:

Call a function

Hey again experts: I convert the Access switchboard macro to VBA today. I now have another problem that I cannot figure out. When the macro was converted it placed a call to a public function but it never worked. This is what it is trying to do: CALL ARGUMENT & "()" but it doesn't work. The argument is a string to the function "ExitDB". Any ideas?
0
stevensont
Asked:
stevensont
  • 2
  • 2
1 Solution
 
mbizupCommented:
The code would be like this:


If ExitDB is the name of your function, you would call it like this:


Call ExitDB(ARGUMENT)   '<--- This assumes that ARGUMENT is a string vatiable you need to pass to the ExitDB function

Open in new window


Equivalent code would be:
ExitDB  ARGUMENT

Open in new window

0
 
stevensontAuthor Commented:
Thanks, but argument is the string containing the function name ExitDB.
0
 
mbizupCommented:
Oh!  Okay....

try this -

Dim ARGUMENT as string
ARGUMENT = "ExitDB()"
Eval(ARGUMENT)

Open in new window

0
 
stevensontAuthor Commented:
The eval function solved the problem
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now