Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo Box pass procedure to call

Status
Not open for further replies.

jkafer

Technical User
Feb 13, 2004
32
US
I have a list of reports/processes that are in a table.
And I want to select from that list and call the procedure that I have associated with it.

Here is some sample data:
ReportName ReportFile Procedure
Weekly Rpt rptWkSum cmdWkSumAll


I have a combo box setup on my form. There are 3 columns in the Combo box (the three shown above).

I can pass info to the "Event Procedure" just fine. What I am struggling with is how to "Call" that procedure. I can pass the cmdWkSumAll just fine to the Event Procedure, but how do I do a Call or execute that parameter (that is a procedure).

Simple example of code:

Private Sub Combo20_AfterUpdate()
Dim strCmd
strCmd = Me.Combo20.Column(2)
MsgBox strCmd
Call strCmd

End Sub


 
Have you tried to use the Application.Run method ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Sorry, there is a typo in my original code:
strCmd = Me.Combo20.Column(3)


Yes, I get this message:

Microsoft Access can't find the procedure 'cmdWkSumAll'


cmdWkSumAll is what is getting passed to the procedure.
The cmdWkSumAll does exist, if I type it like this:

call cmdWkSumAll - that works just fine.

I know I could do this with a case statement, but I'm trying to make this dynamic, so as I make more things available, I won't have to edit the vb code.
 
How are ya jkafer . . .

Have a look at the [blue]Eval[/blue] function.

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Hey back at you!


Hmmm - that didn't make a difference.

I changed the call command to be this:

Call Eval(strCmd)

I just get a message that it can't find the name 'cmdWkSumAll' you entered in the expression.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top