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

问题描述 投票:-1回答:1

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

我在这里错过了什么?

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
vba ms-access access-vba
1个回答
0
投票

尝试

strSQLWork = " SELECT tblAB.ID, .,.(lots)...., FROM tblAB " & _
                      " WHERE tblAB.Title = '" & Me.cmbGetRecall & "'" & _
                      " ORDER BY tblAB.CreationDate, tblAB.SolutionTarget, tblAB.StartDate;"
© www.soinside.com 2019 - 2024. All rights reserved.