Ms Access VBa where 条件与 (And) 错误

Ms Access VBa where condition with (And) Error

我有问题或者说我遇到了错误 当 运行 此代码

时,我遇到 "Run Time-error '13' type mismatch" 错误
DoCmd.OpenReport "hamw_m3amala_naw_w_mawad", acViewReport, , "Jori_Mawad = '" & Combo14 & "' " And "ID =" & Combo4

注意 Jori_Mawad 是字符串,ID 是数字

并且没有 (And) 的这两个条件没有任何问题并且工作正常:

DoCmd.OpenReport "hamw_m3amala_naw_w_mawad", acViewReport, , "Jori_Mawad = '" & Combo14 & "'"

DoCmd.OpenReport "hamw_m3amala_naw_w_mawad", acViewReport, , "ID = " & Combo4

你的

And

应该在您用作 where 子句的字符串中,但您 And-ing 是子句的第一部分和第二部分。

尝试

"Jori_Mawad = '" & Combo14 & "' And ID =" & Combo4