这可能是一个简单的解决方法。我眼中的东西并没有被抓住。我一直收到运行时错误,3464数据类型在条件表达式中不匹配。错误发生在intX行中。我有一个命令按钮' cmdShowLot'。我正在尝试检查tblLots的lotID,确保表单上的tblLots和customerID上的ownerID匹配。我将不胜感激任何帮助。
Private Sub cmdShowLots_Click()
Dim intX As Integer
intX = DCount("fldLotID", "tblLots", "fldOwnerID = '" & Me.fldCustomerID & "'")
If intX = 0 Then
MsgBox "This Customer does not own a lot."
Else
DoCmd.OpenReport "rptCutomerLots", acViewReport, "", "", acNormal
End If
End Sub
答案 0 :(得分:1)
假设fldOwnerID是一个数字,请从此表达式中删除撇号:
"fldOwnerID = '" & Me.fldCustomerID & "'"
所以只是
"fldOwnerID = " & Me.fldCustomerID