Calling A Procedure

yeatmanj

Loose Cannon
Local time
Today, 01:36
Joined
Oct 11, 2000
Messages
195
How can I call a procedure using a variable or an me. object.

I have a list box that someone selects a document name from which in turn stores the name in a variable. I don't want a mile long string of if statements to call the 34 different procedures there are to choose from. That would be a real pain.

Thanks in Advance.
 
(Really difficult...)

You can do like this:

All public function(s) are known by SQL-Statements. When your funcs are like this you can choose by:

Function test1()
test1 = 123
End Function

Sub test2()
Dim strFunctionName As String
Dim rs As Recordset
Dim SQL As String
Dim dbCurr As DAO.Database

strFunctionName = "test1()"
Set dbCurr = CurrentDb
SQL = "SELECT " & strFunctionName & " AS myValue FROM tblLinien;" ' requires any tableName, here: "tblLinien"
Set rs = dbCurr.OpenRecordset(SQL)
MsgBox rs!myValue

End Sub
 
I appreciate the input, but I don't understand how it works. Could you explain or include descriptions. Or if anyone else has an easier solution. It would be nice if I could create a list of procedures and have the user be able to select the one that is appropriate to their use.

Thanks again
 

Users who are viewing this thread

Back
Top Bottom