| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 451 人关注过本帖
标题:VB+access中出现了问题,高手帮忙。
只看楼主 加入收藏
woshiyimao
Rank: 1
等 级:新手上路
帖 子:62
专家分:0
注 册:2007-8-29
结帖率:100%
收藏
 问题点数:0 回复次数:1 
VB+access中出现了问题,高手帮忙。
我用3个ADODC连接1一个库,用3个DATAGRID显示其中的字段,添加的时候用TEXT没问题,修改的时候说找不到字段。
程序代码:
Private Sub Cmd_Modi_Click()

 '初始化编辑车间生产日报信息
  编辑车间生产日报.lblDate = Format(DtCheckDate.Value, "yyyy-mm-dd")    '日报日期
  编辑车间生产日报.OriEmpId = Adodc1.Recordset.Fields(21)                '产品编号   
  UpperEmp.EmpId = 编辑车间生产日报.OriEmpId
  UpperEmp.GetInfo (UpperEmp.EmpId)                                  '读取选择产品的信息
  编辑车间生产日报.ComboEmp = UpperEmp.EmpName                       '产品名称
  编辑车间生产日报.txtyy1yl = Adodc1.Recordset.Fields(22)             '原药1用量
  编辑车间生产日报.txtyy2yl = Adodc1.Recordset.Fields(23)             '原药2用量
  编辑车间生产日报.txtyy3yl = Adodc1.Recordset.Fields(24)             '原药3用量
  编辑车间生产日报.txtjgl = Adodc1.Recordset.Fields(25)               '加工量
  编辑车间生产日报.txtyll = Adodc1.Recordset.Fields(26)               '用料量
  编辑车间生产日报.txtrcl = Adodc1.Recordset.Fields(27)               '日产量
  编辑车间生产日报.txtrkl = Adodc1.Recordset.Fields(28)               '入库量
  编辑车间生产日报.txtMemo1 = Trim(Adodc1.Recordset.Fields(29))      '备注
  编辑车间生产日报.txtbz_jg = Trim(Adodc1.Recordset.Fields(30))      '加工班组
  编辑车间生产日报.txtbzh_jg = Trim(Adodc1.Recordset.Fields(31))     '加工班长
  编辑车间生产日报.txtyy1mc = Trim(Adodc1.Recordset.Fields(32))      '原药1名称
  编辑车间生产日报.txtyy2mc = Trim(Adodc1.Recordset.Fields(33))      '原药2名称
  编辑车间生产日报.txtyy3mc = Trim(Adodc1.Recordset.Fields(34))      '原药3名称
  编辑车间生产日报.txtyy1pc = Trim(Adodc1.Recordset.Fields(35))      '原药1批次
  编辑车间生产日报.txtyy2pc = Trim(Adodc1.Recordset.Fields(36))      '原药2批次
  编辑车间生产日报.txtyy3pc = Trim(Adodc1.Recordset.Fields(37))      '原药3批次
  编辑车间生产日报.txtpc_jg = Trim(Adodc1.Recordset.Fields(38))      '加工批次
  编辑车间生产日报.txttlpc = Trim(Adodc1.Recordset.Fields(39))       '投料批次
  编辑车间生产日报.txtclpc = Trim(Adodc1.Recordset.Fields(40))       '出料批次
  编辑车间生产日报.txtcll = Adodc1.Recordset.Fields(41)              '出料量
  编辑车间生产日报.txtclhl = Adodc1.Recordset.Fields(42)             '出料含量
  编辑车间生产日报.txtclsl = Adodc1.Recordset.Fields(43)             '出料收率
  编辑车间生产日报.txtbz_sc = Trim(Adodc1.Recordset.Fields(44))      '生产班组
  编辑车间生产日报.txtbzh_sc = Trim(Adodc1.Recordset.Fields(45))     '生产班长
  编辑车间生产日报.txtbz_bz = Trim(Adodc1.Recordset.Fields(46))      '包装班组
  编辑车间生产日报.txtbzh_bz = Trim(Adodc1.Recordset.Fields(47))     '包装班长
  编辑车间生产日报.txtmemo2 = Trim(Adodc1.Recordset.Fields(48))      '包装备注
  编辑车间生产日报.txtmemo3 = Trim(Adodc1.Recordset.Fields(49))      '生产备注
  编辑车间生产日报.txtryys = Trim(Adodc1.Recordset.Fields(50))       '人员因素
  编辑车间生产日报.txtsbys = Trim(Adodc1.Recordset.Fields(51))       '设备因素
  编辑车间生产日报.txtwlys = Trim(Adodc1.Recordset.Fields(52))       '物料因素
  编辑车间生产日报.txtzdys = Trim(Adodc1.Recordset.Fields(53))       '制度因素
  编辑车间生产日报.txthjys = Trim(Adodc1.Recordset.Fields(54))       '环境因素
  编辑车间生产日报.txtrkpc = Trim(Adodc1.Recordset.Fields(56))       '入库批次
  编辑车间生产日报.txtbzgg = Trim(Adodc1.Recordset.Fields(57))       '包装规格
  编辑车间生产日报.txtylpc = Trim(Adodc1.Recordset.Fields(55))       '用料批次
  编辑车间生产日报.Show 1
  If 编辑车间生产日报.TmpOk = True Then
    ComboDep.Text = CurDep.DepName
    Refresh_Check
  End If
End Sub
从红色的开始一下字段都无法找到项目。


[ 本帖最后由 woshiyimao 于 2010-5-8 11:19 编辑 ]
搜索更多相关主题的帖子: access 
2010-05-08 11:06
woshiyimao
Rank: 1
等 级:新手上路
帖 子:62
专家分:0
注 册:2007-8-29
收藏
得分:0 
Private Sub Refresh_Check()
Set DataGrid1.DataSource = Adodc1
Set DataGrid2.DataSource = Adodc2
Set DataGrid3.DataSource = Adodc3
 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 剂型, " _
            + " c.bzgg as 包装规格, c.ylpc As 用料批次, c.rcl as 日产量, c.rkl As 入库量, " _
            + " c.rkpc as 入库批次, c.Memo2 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"
   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 剂型," _
            + " c.tlpc as 投料批次, c.clpc as 出料批次, c.cll as 出料量, c.clhl as 出料含量, c.clsl as 出料收率, c.Memo3 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 "
  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
End Sub
这是前面的代码

2010-05-08 11:21
快速回复:VB+access中出现了问题,高手帮忙。
数据加载中...
 
   



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

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