标题:大家帮忙看看,为什么提示“对象'refresh'的方法'iadodc'失败”错误
只看楼主
woshiyimao
Rank: 1
等 级:新手上路
帖 子:62
专家分:0
注 册:2007-8-29
结帖率:100%
 问题点数:0 回复次数:0 
大家帮忙看看,为什么提示“对象'refresh'的方法'iadodc'失败”错误

Private Sub Refresh_Check()
 lblDate.Caption = DtCheckDate.Value
   '设置查询条件
  If Trim(ComboDep.Text) = "" Then
    SchCnd = ""
  Else
    SchCnd = " And e.DepId=" + Trim(Str(nDepId))
  End If
 
 '设置ADO控件的连接字符串
  Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" _
          + App.Path + "\生产管理信息库.mdb;Persist Security Info=False" & ";Jet OLEDB:Database password=800622lx"
        
  '设置数据源
  If CurDep.Describes = "制剂车间" Then
  lbl_biaoti.Caption = "制剂车间生产日报(加工部分)"
  lbl_biaoti2.Caption = "制剂车间生产日报(包装部分)"
  lbl_biaoti2.Visible = True
  DataGrid1.Visible = True
  DataGrid2.Visible = True
  DataGrid3.Visible = False
  End If
  Jgbf = "SELECT d.DepName As 部门, e.hl As 含量, e.EmpName As 产品名称, " _
            + " e.jx As 剂型, c.yy1mc As 原药1名称, c.yy1yl As 原药1用量, c.yy1pc As 原药1批次, c.yy2mc As 原药2名称, " _
            + " c.yy2yl As 原药2用量, c.yy2pc As 原药2批次, c.yy3mc As 原药3名称, c.yy3yl As 原药3用量, c.yy3pc As 原药3批次, c.jgl As 加工量, " _
            + " c.pc_jg As 加工批次, c.Memo1 As 备注" _
            + " FROM Departments d, Employees e, Checkin c" _
            + " WHERE c.CheckDate='" + Trim(Format(DtCheckDate.Value, "yyyy-mm-dd")) _
            + "' And e.EmpId=c.EmpId And e.DepId=d.DepId " + SchCnd + " ORDER BY d.DepId, e.EmpId"
     Adodc1.RecordSource = Jgbf
     Adodc1.Refresh
     With DataGrid1
  .Columns(0).Width = 1200
  .Columns(1).Width = 1000
  .Columns(2).Width = 1000
  .Columns(3).Width = 1000
  .Columns(4).Width = 1200
  .Columns(5).Width = 1200
  .Columns(6).Width = 1200
  .Columns(7).Width = 1200
  .Columns(8).Width = 1200
  .Columns(9).Width = 1200
  .Columns(10).Width = 1200
  .Columns(11).Width = 1200
  .Columns(12).Width = 1200
  .Columns(13).Width = 1000
  .Columns(14).Width = 1000
  .Columns(15).Width = 1200
     End With
     Adodc2.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" _
          + App.Path + "\生产管理信息库.mdb;Persist Security Info=False" & ";Jet OLEDB:Database password=800622lx"
     Bzbf = "SELECT d.DepName As 部门, e.hl As 含量, e.EmpName As 产品名称, e.jx As 剂型, b.bzgg As 包装规格, " _
            + " b.ylpc As 用料批次, b.rcl As 日产量, b.rkl As 入库量, b.rkpc As 入库批次, b.Memo2 As 备注" _
            + " FROM Departments d, Employees e, bzrb b" _
            + " WHERE c.CheckDate='" + Trim(Format(DtCheckDate.Value, "yyyy-mm-dd")) _
            + "' And e.EmpId=c.EmpId And e.DepId=d.DepId " + SchCnd + " ORDER BY d.DepId, e.EmpId"
   Adodc2.RecordSource = Bzbf
   Adodc2.Refresh
     With DataGrid2
  .Columns(0).Width = 1200
  .Columns(1).Width = 1000
  .Columns(2).Width = 1000
  .Columns(3).Width = 1000
  .Columns(4).Width = 1000
  .Columns(5).Width = 1000
  .Columns(6).Width = 1000
  .Columns(7).Width = 1000
  .Columns(8).Width = 1000
  .Columns(9).Width = 1200
     End With
    If CurDep.Describes = "合成车间" Then
    lbl_biaoti2.Visible = False
    DataGrid1.Visible = False
    DataGrid2.Visible = False
    DataGrid3.Visible = True
    lbl_biaoti.Caption = "合成车间生产日报"
   End If
      Adodc3.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" _
          + App.Path + "\生产管理信息库.mdb;Persist Security Info=False" & ";Jet OLEDB:Database password=800622lx"
      Scbf = "SELECT d.DepName As 部门, e.hl as 含量, e.EmpName As 产品名称, e.jx as 剂型," _
            + " s.tlpc as 投料批次, s.clpc as 出料批次, s.cll as 出料量, s.clhl as 出料含量, s.clsl as 出料收率, s.Memo3 As 备注 " _
            + " FROM Departments d, Employees e, scrb s" _
            + " WHERE c.CheckDate='" + Trim(Format(DtCheckDate.Value, "yyyy-mm-dd")) _
            + "' And e.EmpId=c.EmpId And e.DepId=d.DepId " + SchCnd + " ORDER BY d.DepId, e.EmpId "
  Adodc3.RecordSource = Scbf
  Adodc3.Refresh
     With DataGrid3
  .Columns(0).Width = 1200
  .Columns(1).Width = 1000
  .Columns(2).Width = 1000
  .Columns(3).Width = 1000
  .Columns(4).Width = 1000
  .Columns(5).Width = 1000
  .Columns(6).Width = 1000
  .Columns(7).Width = 1000
  .Columns(8).Width = 1000
  .Columns(9).Width = 1200
     End With
      Adodc4.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" _
          + App.Path + "\生产管理信息库.mdb;Persist Security Info=False" & ";Jet OLEDB:Database password=800622lx"
      YXys = "SELECT d.DepName As 部门, e.hl as 含量, e.EmpName As 产品名称, e.jx as 剂型," _
            + " y.ryys as 人员因素, y.sbys as 设备因素 ,y.wlys as 物料因素 ,y.zdys as 制度因素 ,y.hjys as 环境因素 " _
            + " FROM Departments d, Employees e, yxys y" _
            + " WHERE c.CheckDate='" + Trim(Format(DtCheckDate.Value, "yyyy-mm-dd")) _
            + "' And e.EmpId=c.EmpId And e.DepId=d.DepId " + SchCnd + " ORDER BY d.DepId, e.EmpId "
  Adodc4.RecordSource = YXys
  Adodc4.Refresh
     With DataGrid4
  .Columns(0).Width = 1200
  .Columns(1).Width = 1000
  .Columns(2).Width = 1000
  .Columns(3).Width = 1000
     End With

End Sub
搜索更多相关主题的帖子: iadodc refresh 对象 提示 失败 
2010-05-07 14:20



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-305734-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.399923 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved