📄 form2.frm
字号:
wuzi_arr_zcbh(i) = Adodc1.Recordset("资产编号").Value
End If
If Not IsNull(Adodc1.Recordset("分类号").Value) Then
wuzi_arr_flh(i) = Adodc1.Recordset("分类号").Value
End If
If Not IsNull(Adodc1.Recordset("名称").Value) Then
wuzi_arr_mc(i) = Adodc1.Recordset("名称").Value
End If
If Not IsNull(Adodc1.Recordset("规格型号").Value) Then
wuzi_arr_ggxh(i) = Adodc1.Recordset("规格型号").Value
End If
If Not IsNull(Adodc1.Recordset("使用状态").Value) Then
wuzi_arr_syzt(i) = Adodc1.Recordset("使用状态").Value
End If
If Not IsNull(Adodc1.Recordset("使用方向").Value) Then
wuzi_arr_syfx(i) = Adodc1.Recordset("使用方向").Value
End If
If Not IsNull(Adodc1.Recordset("单位").Value) Then
wuzi_arr_dw(i) = Adodc1.Recordset("单位").Value
End If
If Not IsNull(Adodc1.Recordset("备注").Value) Then
wuzi_arr_bz(i) = Adodc1.Recordset("备注").Value
End If
Adodc1.Recordset.MoveNext
Next i
ActiveReport2.zcbh11.Caption = wuzi_arr_zcbh(0)
ActiveReport2.zcbh12.Caption = wuzi_arr_zcbh(1)
ActiveReport2.zcbh13.Caption = wuzi_arr_zcbh(2)
ActiveReport2.zcbh14.Caption = wuzi_arr_zcbh(3)
ActiveReport2.zcbh15.Caption = wuzi_arr_zcbh(4)
ActiveReport2.mc11.Caption = wuzi_arr_mc(0)
ActiveReport2.mc12.Caption = wuzi_arr_mc(1)
ActiveReport2.mc13.Caption = wuzi_arr_mc(2)
ActiveReport2.mc14.Caption = wuzi_arr_mc(3)
ActiveReport2.mc15.Caption = wuzi_arr_mc(4)
ActiveReport2.ggxh11.Caption = wuzi_arr_ggxh(0)
ActiveReport2.ggxh12.Caption = wuzi_arr_ggxh(1)
ActiveReport2.ggxh13.Caption = wuzi_arr_ggxh(2)
ActiveReport2.ggxh14.Caption = wuzi_arr_ggxh(3)
ActiveReport2.ggxh15.Caption = wuzi_arr_ggxh(4)
ActiveReport2.dw11.Caption = wuzi_arr_dw(0)
ActiveReport2.dw12.Caption = wuzi_arr_dw(1)
ActiveReport2.dw13.Caption = wuzi_arr_dw(2)
ActiveReport2.dw14.Caption = wuzi_arr_dw(3)
ActiveReport2.dw15.Caption = wuzi_arr_dw(4)
'ActiveReport2.sl11.Caption = wuzi_arr_sl(0)
'ActiveReport2.sl12.Caption = wuzi_arr_sl(1)
'ActiveReport2.sl13.Caption = wuzi_arr_sl(2)
'ActiveReport2.sl14.Caption = wuzi_arr_sl(3)
'ActiveReport2.sl15.Caption = wuzi_arr_sl(4)
ActiveReport2.syzt11.Caption = wuzi_arr_syzt(0)
ActiveReport2.syzt12.Caption = wuzi_arr_syzt(1)
ActiveReport2.syzt13.Caption = wuzi_arr_syzt(2)
ActiveReport2.syzt14.Caption = wuzi_arr_syzt(3)
ActiveReport2.syzt15.Caption = wuzi_arr_syzt(4)
ActiveReport2.syfx11.Caption = wuzi_arr_syfx(0)
ActiveReport2.syfx12.Caption = wuzi_arr_syfx(1)
ActiveReport2.syfx13.Caption = wuzi_arr_syfx(2)
ActiveReport2.syfx14.Caption = wuzi_arr_syfx(3)
ActiveReport2.syfx15.Caption = wuzi_arr_syfx(4)
ActiveReport2.bz11.Caption = wuzi_arr_bz(0)
ActiveReport2.bz12.Caption = wuzi_arr_bz(1)
ActiveReport2.bz13.Caption = wuzi_arr_bz(2)
ActiveReport2.bz14.Caption = wuzi_arr_bz(3)
ActiveReport2.bz15.Caption = wuzi_arr_bz(4)
ActiveReport2.Label5.Caption = Me.Label7.Caption
ActiveReport2.Label6.Caption = Me.Label8.Caption
ActiveReport2.Caption = "山东科技大学物资借用管理系统"
ActiveReport2.Show vbModal
End Sub
Private Sub Command4_Click()
wuzi_newdan_flag = False
Unload Me
End Sub
Private Sub Command5_Click()
If wuzi_newdan_flag = True Then
MsgBox "当前为新单!"
Exit Sub
End If
Dim tem_danju As String
Adodc2.ConnectionString = " Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & curpath + "wupin.mdb;Persist Security Info=False"
Adodc2.CommandType = adCmdText
Adodc2.RecordSource = "select max(mid(单据号,5,4)) as tem_danju from wuzi where mid(单据号,1,4)='" & Combo1.Text & "'"
Adodc2.Refresh
If Not IsNull(Adodc2.Recordset("tem_danju").Value) Then
s = CStr(Val(Adodc2.Recordset("tem_danju").Value) + 1)
For i = 0 To 3 - Len(s)
t = t + "0"
Next i
s = t + s
Label8.Caption = "(" + Combo1.Text + ")" + "第" + s + "号"
wuzi_str_biaodan = Combo1.Text + s
Else
Label8.Caption = "(" + Combo1.Text + ")" + "第" + "0001" + "号"
wuzi_str_biaodan = Combo1.Text + "0001"
End If
'MsgBox wuzi_str_biaodan
Adodc1.ConnectionString = " Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & curpath + "wupin.mdb;Persist Security Info=False"
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select * from wuzi where 单据号=" & "'" & wuzi_str_biaodan & "'"
Adodc1.Refresh
'///如果当前的记录个数大于0则提示是否打印后再开新单据
If Adodc1.Recordset.RecordCount > 0 Then
b = MsgBox("需要打印当前验收单吗?", vbYesNo, "提示")
If b = vbYes Then
Call Command3_Click
End If
End If
'////
jyrdw.Text = ""
jyr.Text = ""
bmzg.Text = ""
jbr.Text = ""
zd.Text = ""
Combo1.Text = CStr(Year(Date))
Combo1.Enabled = True '打开combo
wuzi_newdan_flag = True '新开单据
Command1.Enabled = True
End Sub
Private Sub Command6_Click()
Form9.Show
End Sub
Private Sub Command7_Click()
If jyrdw.Text = "" Then
a = MsgBox("借用人单位不能为空!", vbOKOnly, "提示")
Exit Sub
End If
If mc.Text = "" Then
a = MsgBox("名称不能为空!", vbOKOnly, "提示")
Exit Sub
End If
Adodc1.ConnectionString = " Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & curpath + "wupin.mdb;Persist Security Info=False"
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select * from wuzi where 单据号=" & "'" & wuzi_str_biaodan & "'"
Adodc1.Refresh
Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields("借用人单位").Value = jyrdw.Text
If jyr.Text <> "" Then
Adodc1.Recordset.Fields("借用人").Value = jyr.Text
End If
If bmzg.Text <> "" Then
Adodc1.Recordset.Fields("部门主管").Value = bmzg.Text
End If
If jbr.Text <> "" Then
Adodc1.Recordset.Fields("经办人").Value = jbr.Text
End If
If zd.Text <> "" Then
Adodc1.Recordset.Fields("制单").Value = zd.Text
End If
If zcbh.Text <> "" Then
Adodc1.Recordset.Fields("资产编号").Value = zcbh.Text
End If
If flh.Text <> "" Then
Adodc1.Recordset.Fields("分类号").Value = zcbh.Text
End If
Adodc1.Recordset.Fields("名称").Value = mc.Text
If ggxh.Text <> "" Then
Adodc1.Recordset.Fields("规格型号").Value = ggxh.Text
End If
If dw.Text <> "" Then
Adodc1.Recordset.Fields("单位").Value = dw.Text
End If
Adodc1.Recordset.Fields("时间").Value = Date
If syzt.Text <> "" Then
Adodc1.Recordset.Fields("使用状态").Value = syzt.Text
End If
If syfx.Text <> "" Then
Adodc1.Recordset.Fields("使用方向").Value = syfx.Text
End If
Adodc1.Recordset.Fields("归还状态").Value = "未归还"
Adodc1.Recordset.Fields("归还时间").Value = " "
If bz.Text <> "" Then
Adodc1.Recordset.Fields("备注").Value = bz.Text
End If
Adodc1.Recordset.Fields("单据号").Value = wuzi_str_biaodan
Adodc1.Recordset.Update
Adodc1.Recordset.Requery
'*********************************************
'左边验收单显示刷新
save_flag = True
'********************************************
'//如果新开单据则刷新左边显示单据栏
If wuzi_newdan_flag = True Then
Adodc3.ConnectionString = " Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & curpath + "wupin.mdb;Persist Security Info=False"
Adodc3.CommandType = adCmdText
Adodc3.RecordSource = "select distinct(单据号) as 验收单 from wuzi order by 单据号 desc"
Adodc3.Refresh
Adodc3.Recordset.Requery
If Adodc3.Recordset.EOF And Adodc3.Recordset.BOF Then
Else
List1.Clear '先将list 控件内容清空
Adodc3.Recordset.MoveFirst
Do Until Adodc3.Recordset.EOF
List1.AddItem Adodc3.Recordset.Fields("验收单").Value
Adodc3.Recordset.MoveNext
Loop
End If
wuzi_newdan_flag = False
End If
'// 刷左边新单显示栏
Command1.Enabled = True
Command7.Enabled = False '保存功能开启
Command8.Enabled = False '返回功能开启
Command2.Enabled = True '删除功能屏蔽
Command3.Enabled = True '打印功能屏蔽
Command5.Enabled = True '入库功能屏蔽
DataGrid1.Enabled = True '打开
zcbh.SetFocus
List1.Enabled = True
zcbh.Text = ""
flh.Text = ""
mc.Text = ""
ggxh.Text = ""
dw.Text = ""
syzt.Text = ""
syfx.Text = ""
bz.Text = ""
End Sub
Private Sub Command8_Click()
Command1.Enabled = True
Command7.Enabled = False '保存功能开启
Command8.Enabled = False '返回功能开启
Command2.Enabled = True '删除功能屏蔽
Command3.Enabled = True '打印功能屏蔽
Command5.Enabled = True '入库功能屏蔽
DataGrid1.Enabled = True '表格功能打开
List1.Enabled = True
If wuzi_newdan_flag = True Then
Combo1.Enabled = True
End If
zcbh.Text = ""
flh.Text = ""
mc.Text = ""
ggxh.Text = ""
dw.Text = ""
syzt.Text = ""
syfx.Text = ""
bz.Text = ""
jyrdw.Enabled = False
jyr.Enabled = False
bmzg.Enabled = False
jbr.Enabled = False
zd.Enabled = False
zcbh.Enabled = False
flh.Enabled = False
mc.Enabled = False
ggxh.Enabled = False
dw.Enabled = False
syzt.Enabled = False
syfx.Enabled = False
bz.Enabled = False
End Sub
Private Sub Command9_Click()
DataGrid1.AllowUpdate = True
End Sub
Private Sub DataGrid1_Change()
If Adodc1.Recordset.EOF Or Adodc1.Recordset.BOF Then
Exit Sub
End If
If Adodc1.Recordset.EditMode Then
Adodc1.Recordset.Update
End If
End Sub
Private Sub Form_Load()
If Right(App.path, 1) = "\" Then ' 若 App.Path 为根目录
curpath = App.path
Else
curpath = App.path + "\"
End If
Label7.Caption = CStr(Year(Date)) + "年" + CStr(Month(Date)) + "月" + CStr(Day(Date)) + "日"
Adodc3.ConnectionString = " Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & curpath + "wupin.mdb;Persist Security Info=False"
Adodc3.CommandType = adCmdText
Adodc3.RecordSource = "select distinct(单据号) as 验收单 from wuzi order by 单据号 desc"
Adodc3.Refresh
Adodc3.Recordset.Requery
If Adodc3.Recordset.EOF And Adodc3.Recordset.BOF Then
Else
List1.Clear '先将list 控件内容清空
Adodc3.Recordset.MoveFirst
Do Until Adodc3.Recordset.EOF
List1.AddItem Adodc3.Recordset.Fields("验收单").Value
Adodc3.Recordset.MoveNext
Loop
List1.ListIndex = 0
Adodc2.ConnectionString = " Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & curpath + "wupin.mdb;Persist Security Info=False"
Adodc2.CommandType = adCmdText
Adodc2.RecordSource = "select * from wuzi where 单据号='" & List1.Text & "'"
Adodc2.Refresh
Combo1.Text = Year(Date)
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
Main.mnu_file.Visible = True
Main.mnu_chaxun.Visible = True
Adodc4.ConnectionString = " Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & curpath + "wupin.mdb;Persist Security Info=False"
Adodc4.CommandType = adCmdTable
Adodc4.RecordSource = "bdnum"
Adodc4.Refresh
Adodc4.Recordset.Fields("bdnum").Value = biaodan + 1
Adodc4.Recordset.Update
End Sub
Private Sub List1_Click()
wuzi_newdan_flag = False '只要是一单击左边list就表明不是新单据
Command1.Enabled = True
wuzi_str_biaodan = List1.Text
Command2.Enabled = True
Adodc1.ConnectionString = " Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & curpath + "wupin.mdb;Persist Security Info=False"
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select * from wuzi where 单据号=" & "'" & wuzi_str_biaodan & "'"
Adodc1.Refresh
If Not IsNull(Adodc1.Recordset.Fields("借用人单位").Value) Then
jyrdw.Text = Adodc1.Recordset.Fields("借用人单位").Value
Else
jyrdw.Text = ""
End If
If Not IsNull(Adodc1.Recordset.Fields("借用人").Value) Then
jyr.Text = Adodc1.Recordset.Fields("借用人").Value
Else
jyr.Text = ""
End If
If Not IsNull(Adodc1.Recordset.Fields("部门主管").Value) Then
bmzg.Text = Adodc1.Recordset.Fields("部门主管").Value
Else
bmzg.Text = ""
End If
If Not IsNull(Adodc1.Recordset.Fields("经办人").Value) Then
jbr.Text = Adodc1.Recordset.Fields("经办人").Value
Else
jbr.Text = ""
End If
If Not IsNull(Adodc1.Recordset.Fields("制单").Value) Then
zd.Text = Adodc1.Recordset.Fields("制单").Value
Else
zd.Text = ""
End If
Combo1.Text = Mid(Adodc1.Recordset("单据号").Value, 1, 4)
Label8.Caption = "(" + Mid(wuzi_str_biaodan, 1, 4) + ")" + "第" + Mid(wuzi_str_biaodan, 5, 4) + "号"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -