Bill Benson
bensonforums at gmail.com
Sat Apr 12 19:48:22 CDT 2014
I want some code which calls a dynamically named function and has a dynamically listed number of arguments to do this upon re-open of a database. So what I did was set the default form of my database to this invisible form. In that form, on load, I check a record in a table which should indicate the function or sub I want to call. So far I have tested this only with one routine, and while I can call that routine, I cannot seem to get the arguments to take hold. Basically, I get that they are missing, regardless how I have tried to structure the function call. A simple example: Private Sub Form_Load() Dim strRoutine As String strRoutine = Nz(DLookup("Function", "Tbl2"), "") If strRoutine <> "" Then 'Suppose Function had value 'DropIndexes' Debug.Print Application.Run(strRoutine, , True) End If Function DropIndexes(Optional T, Optional Restarted) Dim D As DAO.Database Dim i As Long 'Tried to pass nothing for T and True for Restarted Debug.print Ismissing(Restarted) ' 'Result: 'True Based on this result I cannot even begin to explore further what I might do if the arguments are different, listed in different order, or whatever, for a different dynamically named routine. Thanks if anyone can help me get the arguments to take hold.