vba 访问“运行时错误 3464”条件表达式中的数据类型不匹配

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21897455/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-12 02:02:59  来源:igfitidea点击:

Access "Runtime error 3464" Data type mismatch in criteria expression

vbams-accessaccess-vba

提问by user3276522

Upon clicking a drop down menu and section of an entry that I have put in there, I get runtime error 3464 which is data type mismatch and stops at Set rsrecall = dbsrecall.OpenRecordset(strSQLWork)

单击下拉菜单和我放入的条目部分后,我收到运行时错误 3464,这是数据类型不匹配并停止在 Set rsrecall = dbsrecall.OpenRecordset(strSQLWork)

What am I missing here?

我在这里缺少什么?

Dim dbsrecall As DAO.Database
Dim rsrecall As DAO.Recordset
Dim intRecCnt As Integer

On Error GoTo Err_Click

strSQLWork = "SELECT tblAB.ID, .,.(lots)...., FROM tblAB WHERE tblAB.Title = " & Me.cmbGetRecall & " ORDER BY tblAB.CreationDate, tblAB.SolutionTarget, tblAB.StartDate;"

Set dbsrecall = CurrentDb()
Set rsrecall = dbsrecall.OpenRecordset(strSQLWork)

rsrecall.MoveFirst

ReDim arrRecall(1, 70)

arrRecall(1, 1) = rsrecall!abc
arrRecall(1, 2) = rsrecall!def
.
.(contd.)
.
arrRecall(1,70) = rsrecall!xyz

Me.txtTitle.SetFocus
Me.lblRecall.Visible = False
Me.cmbGetRecall.Visible = False

Me.txtqwe = arrRecall(1, 4)
Me.txtrty = arrRecall(1, 5)
Me.txtuio = arrRecall(1, 6)
.
.(contd.)  
.
me.txtghj = arrRecall(1,70)

Exit Sub
Err_Click:
resp = MsgBox("No records were found for this selection." & Chr(10) & Chr(13) & Chr(10) & Chr(13) & "Please try again.", vbOKOnly)

Me.cmbSol = ""
Me.cmbSol.SetFocus

回答by workingDeath

try

尝试

strSQLWork = " SELECT tblAB.ID, .,.(lots)...., FROM tblAB " & _
                      " WHERE tblAB.Title = '" & Me.cmbGetRecall & "'" & _
                      " ORDER BY tblAB.CreationDate, tblAB.SolutionTarget, tblAB.StartDate;"