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

时间:2014-02-20 03:25:58

标签: vba ms-access access-vba

单击下拉菜单和我放入的条目部分后,我得到运行时错误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

1 个答案:

答案 0 :(得分:0)

尝试

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