开发者

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()
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜