MS Access VBA: Optional Argument Does Not Assume Default Value
I imagine this is an easy one. I have the following declarations:
Public Const TABLE_MY_TABLE As String = "my_table"
Sub reloadProjections(startDate As 开发者_开发知识库String, endDate As String, _
Optional tableName As String = TABLE_MY_TABLE)
'Processing occurs here
End Sub
For some reason, when the optional argument is not supplied, tableName does not assume the default value of TABLE_MY_TABLE. When you step through this with a debugger, TABLE_MY_TABLE is set to "my_table" and tableName is an empty string. Does anyone know why?
It works for me. How are you calling it? Try, say:
reloadProjections date(),date()
精彩评论