2014-02-20 29 views
0

一旦單擊下拉菜單和我放在那裏的條目部分,就會得到運行時錯誤3464,它是數據類型不匹配並停在設置rsrecall = dbsrecall .OpenRecordset(strSQLWork)訪問「運行時錯誤3464」條件表達式中的數據類型不匹配

我在這裏丟失了什麼?

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 
+0

乍一看,我沒有看到一個問題。你的模塊的頂部是否有'Option Explicit'?如果沒有,添加,然後編譯,看看你是否有任何錯誤。 –

+0

我確實有Option Explicit。我在項目的不同部分有相同的arrRecall邏輯,是否有問題? – user3276522

回答

0

嘗試

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

好吧,似乎現在替換爲:運行時錯誤3021:沒有當前記錄在rsrecall.Movefirst – user3276522

+0

已解決: ... WHERE tblAB.Title =「&Me.cmbGetRecall&」ORDER BY .... 謝謝你的幫助 – user3276522

相關問題