MS Access无效使用Null(错误94)

时间:2018-05-11 17:23:40

标签: ms-access access-vba ms-access-2010

有人可以解释一下为什么当我删除我的最后一行代码时它会起作用但是如果我添加我的最后一行代码我会得到ERROR 94

'Variable to set the Event ID too
Dim eventID As Integer
'Variable to set the Event Name too
Dim eventName As String
'Variable to hold the string condition for the Event ID
Dim eventStrCriteria As String
'Variable to hold the Members ID
Dim memberID As Long

memberID = CLng(Me.Text18)
eventStrCriteria = "isNull([check-OutDate]) And (employeeID = " & memberID & ")"
eventID = DLookup("[personelID]", "[tbl_ics238Table]", eventStrCriteria)
MsgBox DLookup("[eventName]", "[tbl_EventInformation]", "[eventID] =" & eventID)

1 个答案:

答案 0 :(得分:0)

可能不是答案,更多评论但还不能,但

eventID = DLookup("[personelID]", "[tbl_ics238Table]", strCriteria)

应该是

eventID = DLookup("[personelID]", "[tbl_ics238Table]", **eventstrCriteria**)

(删除星号)

这会导致第一个dlookup()返回null(我认为),这会导致第二个dlookup错误。