我正在尝试创建一个函数,该函数可以根据共享表上的员工 ID 返回员工姓名,但会弹出错误:
“运行时错误'3075':查询表达式'[Employee ID] ='XXXXX'中的字符串语法错误”。
我试图实现我在网上找到的不同答案,但我仍然无法修复它。下面是我有问题的代码。
Function getName() As String
Dim Name As String
getName = DLookup("[Employee Name]", "ID Table", "[Employee ID] = '" & getID & "'")
'getID is a function that returns a string and both Employee Name and Employee ID are in the ID Table
End Function