[AccessD] Application.Run not passing my arguments declared optionally

Stuart McLachlan stuart at lexacorp.com.pg
Sat Apr 12 21:28:39 CDT 2014


It works if you pass vbNull for the first argument.  :(

On 12 Apr 2014 at 20:48, Bill Benson wrote:

> 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.
> 
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 




More information about the AccessD mailing list