【问题标题】:I can't use the UBound() function in VBA Access. Seems like it's not recognised我不能在 VBA Access 中使用 UBound() 函数。好像不能识别
【发布时间】:2015-08-05 16:17:57
【问题描述】:

我在 Access 2013 上工作,但我在使用 UBound() 时遇到了问题。编译器无法识别该函数。也许这个函数来自一个特定的库,但微软网站上没有提到它。 这是我使用的代码:

Dim Key(2)  As String

Key(0) = "0"
Key(1) = "1"
Key(2) = "2"

UBound(Key,1)

有人有同样的问题吗?

谢谢!

【问题讨论】:

  • 如果你对UBound返回的值做一些事情,你的代码是否能正确编译,也许像这样? MsgBox UBound(Key, 1)
  • 是的,它就是这样工作的,谢谢 :) HansUp

标签: ms-access vba ms-access-2013


【解决方案1】:

这是一个你需要将它分配给某物的函数。

Dim i As Integer
i = UBound(Key, 1)

你也可以使用它作为变量的返回

For i = 1 to UBound(Key, 1)

【讨论】:

  • 谢谢 MatthewD,只要我把“=”放在 Ubound 前面,编译器最终就认出了它。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多