检索表信息时出现3265运行时错误

时间:2014-06-25 11:19:05

标签: ms-access access-vba ms-access-2010

我在第二张表格上得到3265错误! line txtpsid行工作正常。 Queue,caseid和repwrkdt都是表格中的有效字段....

Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim sqlstr, sqlstr2 As String

Set db = CurrentDb()

sqlstr = "Select [RepID] From [TblFromRandomizer] Where Isnull ([Status])"

Set rs = db.OpenRecordset(sqlstr)

    Forms![FrmRcsQualityTool]![TXTPsid] = rs.Fields("RepID").Value
    Forms![FrmRcsQualityTool]![CMBQueue] = rs.Fields("Queue").Value
    Forms![FrmRcsQualityTool]![TXTItem] = rs.Fields("CaseID").Value
    Forms![FrmRcsQualityTool]![TXTItemdate] = rs.Fields("RepWrkDt").Value

Call search

1 个答案:

答案 0 :(得分:2)

[Queue]字段不在记录集中,因为您没有将它包含在SELECT语句中。运行SQL代码时,只检索[RepID]字段。您需要将其他字段添加到SQL语句的列列表中,例如

SELECT [RepID], [Queue], [CaseID], [RepWrkDt] FROM [TblFromRandomizer] ...