Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我开始使用 VBA 编辑器在 Access 2010 中创建自定义函数,但我不断收到预期的语句结束错误。
这是代码:
Public Function getPayTotal(ByVal StudentID As Long) As Long Return StudentID End Function
我完全不知道为什么这不起作用。调试不断将我送回 Return StudentID 行。我是不是在看一些非常简单的东西?
不返回:
Public Function getPayTotal(ByVal StudentID As Long) As Long getPayTotal = StudentID End Function
您可以像这样调用该函数:
Sub theFunction getPayTotal 21 ''Or Call getPayTotal(21) ''Or r = getPayTotal(21) End Sub
换句话说,要小心括号。