Private Sub Command1_Click(Index As Integer)
     Select Case Index
     Case 0
      On Error GoTo err1
      Adodc1.Recordset.UpdateBatch adAffectAll
     Case 1
      On Error GoTo err1
      Adodc1.Refresh
     Case 2
      aa = InputBox("查找附件编号:", "*")
      If aa <> "*" Then
      Adodc1.Recordset.MoveFirst
      Adodc1.Recordset.Find "附件编号 like'" & aa & "*'"
      End If
     End Select
     Exit Sub
err1:
     MsgBox Err.Description
End Sub给车间做的一个数据库管理软件,
这个是修改模块中按键的代码,
在运行到:Adodc1.Recordset.MoveFirst 这里的时候提示错误91,
with变量什么的。
请高手帮忙看看问题出在哪里?谢谢!!

解决方案 »

  1.   

    假如是SQl数据库 :
          Adodc1.Recordset.Find "附件编号 like '%" & aa & "%'"
    if adodc1.Recordset.RecordCount<>0 then
          Adodc1.Recordset.MoveFirst
    end if
      

  2.   

    是用access2003做的表,
    SQL我不是很懂。
    这些也都是现学现用的,
    能麻烦说的详细一点吗?
    谢谢~
      

  3.   

    if adodc1.Recordset.RecordCount<>0 then
          Adodc1.Recordset.MoveFirst
    end if
    做一个判断试试看