开发者

MS Access VBA: Optional Argument Does Not Assume Default Value

开发者 https://www.devze.com 2023-02-08 22:46 出处:网络
I imagine this is an easy one.I have the following declarations: Public Const TABLE_MY_TABLE As String = \"my_table\"

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

精彩评论

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