当输入信息后,点保存出现“标准表达式数据类型不匹配”,请高手指点。
Dim SchCnd As String '查询条件Dim nDepId As Long '部门编号
Public TmpOk As Boolean
Private Sub Refresh_Check()
'设置查询条件
If Trim(ComboDep.Text) = "" Then
SchCnd = ""
Else
SchCnd = " And e.DepId=" + Trim(Str(nDepId))
End If
lblDate.Caption = DtCheckDate.Value
'设置ADO控件的连接字符串
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" _
+ App.Path + "\生产管理信息库.mdb;Persist Security Info=False" & ";Jet OLEDB:Database password=800622lx"
Adodc2.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
DataGrid2.Visible = True
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"
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"
Adodc1.RecordSource = Jgbf
Adodc2.RecordSource = Bzbf
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.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
End If
If CurDep.Describes = "合成车间" Then
lbl_biaoti2.Visible = False
DataGrid2.Visible = False
lbl_biaoti.Caption = "合成车间生产日报"
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 "
Adodc1.RecordSource = Scbf
Adodc1.Refresh
With DataGrid1
.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 If
End Sub
Private Sub Timer1_Timer()
StB1.Panels(3) = Date
StB1.Panels(4) = Time
End Sub
Private Sub Cmd_Add_Click()
If Trim(ComboDep.Text) = "" Then
MsgBox "请选择部门"
Exit Sub
End If
Dim mm As Integer
'设置日报日期
编辑车间生产日报.lblDate = Format(DtCheckDate.Value, "yyyy-mm-dd")
UpperEmp.Init
'初始化表单编辑车间生产日报的控件
编辑车间生产日报.ComboEmp.Text = ""
编辑车间生产日报.txtyy1yl = ""
编辑车间生产日报.txtyy2yl = ""
编辑车间生产日报.txtyy3yl = ""
编辑车间生产日报.txtjgl = ""
编辑车间生产日报.txtyll = ""
编辑车间生产日报.txtrcl = ""
编辑车间生产日报.txtrkl = ""
编辑车间生产日报.txtMemo1 = ""
编辑车间生产日报.txtbz_jg = ""
编辑车间生产日报.txtbzh_jg = ""
编辑车间生产日报.txtyy1mc = ""
编辑车间生产日报.txtyy2mc = ""
编辑车间生产日报.txtyy3mc = ""
编辑车间生产日报.txtyy1pc = ""
编辑车间生产日报.txtyy2pc = ""
编辑车间生产日报.txtyy3pc = ""
编辑车间生产日报.txttlpc = ""
编辑车间生产日报.txtclpc = ""
编辑车间生产日报.txtcll = ""
编辑车间生产日报.txtclhl = ""
编辑车间生产日报.txtclsl = ""
编辑车间生产日报.txtpc_jg = ""
编辑车间生产日报.txtbz_sc = ""
编辑车间生产日报.txtbzh_sc = ""
编辑车间生产日报.txtbz_bz = ""
编辑车间生产日报.txtbzh_bz = ""
编辑车间生产日报.txtmemo2 = ""
编辑车间生产日报.txtmemo3 = ""
编辑车间生产日报.txtryys = ""
编辑车间生产日报.txtsbys = ""
编辑车间生产日报.txtwlys = ""
编辑车间生产日报.txtzdys = ""
编辑车间生产日报.txthjys = ""
编辑车间生产日报.txtbzgg = ""
编辑车间生产日报.txtylpc = ""
编辑车间生产日报.txtrkpc = ""
编辑车间生产日报.Show 1
'如果在编辑车间生产日报表单中单击确定按钮,则刷新显示
If 编辑车间生产日报.TmpOk = True Then
ComboDep.Text = CurDep.DepName
Refresh_Check
End If
End Sub
Private Sub Cmd_Back_Click()
Unload Me
End Sub
Private Sub Cmd_Modi_Click()
'初始化编辑车间生产日报信息
编辑车间生产日报.lblDate = Format(DtCheckDate.Value, "yyyy-mm-dd") '日报日期
编辑车间生产日报.OriEmpId = Adodc1.Recordset.Fields(1) '产品编号
UpperEmp.EmpId = 编辑车间生产日报.OriEmpId
UpperEmp.GetInfo (UpperEmp.EmpId) '读取选择产品的信息
编辑车间生产日报.ComboEmp.Text = UpperEmp.EmpName '产品名称
编辑车间生产日报.txtyy1yl.Text = Adodc1.Recordset.Fields(3) '原药1用量
编辑车间生产日报.txtyy2yl.Text = Adodc1.Recordset.Fields(4) '原药2用量
编辑车间生产日报.txtyy3yl.Text = Adodc1.Recordset.Fields(5) '原药3用量
编辑车间生产日报.txtjgl.Text = Adodc1.Recordset.Fields(6) '加工量
编辑车间生产日报.txtyll.Text = Adodc1.Recordset.Fields(7) '用料量
编辑车间生产日报.txtrcl.Text = Adodc1.Recordset.Fields(8) '日产量
编辑车间生产日报.txtrkl.Text = Adodc1.Recordset.Fields(9) '入库量
编辑车间生产日报.txtMemo1.Text = Trim(Adodc1.Recordset.Fields(10)) '备注
编辑车间生产日报.txtbz_jg.Text = Trim(Adodc1.Recordset.Fields(11)) '加工班组
编辑车间生产日报.txtbzh_jg.Text = Trim(Adodc1.Recordset.Fields(12)) '加工班长
编辑车间生产日报.txtyy1mc.Text = Trim(Adodc1.Recordset.Fields(13)) '原药1名称
编辑车间生产日报.txtyy2mc.Text = Trim(Adodc1.Recordset.Fields(14)) '原药2名称
编辑车间生产日报.txtyy3mc.Text = Trim(Adodc1.Recordset.Fields(15)) '原药3名称
编辑车间生产日报.txtyy1pc.Text = Trim(Adodc1.Recordset.Fields(16)) '原药1批次
编辑车间生产日报.txtyy2pc.Text = Trim(Adodc1.Recordset.Fields(17)) '原药2批次
编辑车间生产日报.txtyy3pc.Text = Trim(Adodc1.Recordset.Fields(18)) '原药3批次
编辑车间生产日报.txtpc_jg.Text = Trim(Adodc1.Recordset.Fields(19)) '加工批次
编辑车间生产日报.txttlpc.Text = Trim(Adodc1.Recordset.Fields(20)) '投料批次
编辑车间生产日报.txtclpc.Text = Trim(Adodc1.Recordset.Fields(21)) '出料批次
编辑车间生产日报.txtcll.Text = Adodc1.Recordset.Fields(22) '出料量
编辑车间生产日报.txtclhl.Text = Adodc1.Recordset.Fields(23) '出料含量
编辑车间生产日报.txtclsl.Text = Trim(Adodc1.Recordset.Fields(24)) '出料收率
编辑车间生产日报.txtbz_sc.Text = Trim(Adodc1.Recordset.Fields(25)) '生产班组
编辑车间生产日报.txtbzh_sc.Text = Trim(Adodc1.Recordset.Fields(26)) '生产班长
编辑车间生产日报.txtbz_bz.Text = Trim(Adodc1.Recordset.Fields(27)) '包装班组
编辑车间生产日报.txtbzh_bz.Text = Trim(Adodc1.Recordset.Fields(28)) '包装班长
编辑车间生产日报.txtmemo2.Text = Trim(Adodc1.Recordset.Fields(29)) '包装备注
编辑车间生产日报.txtmemo3.Text = Trim(Adodc1.Recordset.Fields(30)) '生产备注
编辑车间生产日报.txtryys.Text = Trim(Adodc1.Recordset.Fields(31)) '人员因素
编辑车间生产日报.txtsbys.Text = Trim(Adodc1.Recordset.Fields(32)) '设备因素
编辑车间生产日报.txtwlys.Text = Trim(Adodc1.Recordset.Fields(33)) '物料因素
编辑车间生产日报.txtzdys.Text = Trim(Adodc1.Recordset.Fields(34)) '制度因素
编辑车间生产日报.txthjys.Text = Trim(Adodc1.Recordset.Fields(35)) '环境因素
编辑车间生产日报.txtbzgg.Text = Trim(Adodc1.Recordset.Fields(36)) '包装规格
编辑车间生产日报.txtylpc.Text = Trim(Adodc1.Recordset.Fields(37)) '用料批次
编辑车间生产日报.txtrkpc.Text = Trim(Adodc1.Recordset.Fields(38)) '入库批次
编辑车间生产日报.Show 1
If 编辑车间生产日报.TmpOk = True Then
ComboDep.Text = CurDep.DepName
Refresh_Check
End If
End Sub
Private Sub cmd_SumCheck_Click()
If Trim(ComboDep.Text) = "" Then
MsgBox "请选择部门"
Exit Sub
End If
'初始化并打开生产统计窗体
生产统计.OriDepId = nDepId
生产统计.lblMonth = Left(Format(DtCheckDate.Value, "yyyy-mm-dd"), 7)
生产统计.lblDep = ComboDep.Text
生产统计.Show 1
End Sub
Private Sub ComboDep_GotFocus()
DtCheckDate.SetFocus
'设置部门管理控件窗体的位置
部门管理控件.Show 1
'将选择的产品名称显示到ComboUpper控件中
ComboDep.Text = CurDep.DepName
nDepId = CurDep.DepId
Refresh_Check
End Sub
Private Sub Command5_Click()
CommonDialog1.ShowPrinter
CommonDialog1.flags = cdlPDHidePrintToFile
Printer.Orientation = 2 '横向
Me.PrintForm
End Sub
Private Sub DtCheckDate_Change()
Refresh_Check
End Sub
Private Sub Form_Load()
Me.Top = 0
Me.Width = Screen.Width
Me.Height = Screen.Height
Dim yy, mm As Integer
'初始化窗体控件
DtCheckDate.Value = Date
ComboDep.Text = ""
CurDep.Init
Refresh_Check
'根据用户类型设置界面
If CurUser.User_type = 4 Then '不是制剂车间管理员权限则不显示添加、修改、删除。
Cmd_Add.Visible = True
Cmd_Modi.Visible = True
Cmd_Del.Visible = True
End If
If CurUser.User_type = 1 Then
Cmd_Add.Visible = True
Cmd_Modi.Visible = True
Cmd_Del.Visible = True
End If
End Sub