📄 frm_zcyd.frm
字号:
Top = 240
Width = 920
End
Begin VB.CommandButton Command1
Caption = "查询"
Height = 375
Left = 6000
TabIndex = 6
Top = 240
Width = 920
End
Begin VB.TextBox Text1
Height = 350
Left = 4080
TabIndex = 5
Top = 240
Width = 1335
End
Begin VB.ComboBox Combo1
Height = 300
ItemData = "frm_ZCYD.frx":003B
Left = 1320
List = "frm_ZCYD.frx":0057
TabIndex = 4
Text = "资产设备编号"
Top = 240
Width = 1695
End
Begin VB.Label Label1
Caption = "查询条件"
Height = 255
Left = 360
TabIndex = 3
Top = 360
Width = 975
End
End
Begin VB.TextBox Text7
DataField = "数量"
DataSource = "Adodc2"
Height = 375
Left = 2640
TabIndex = 49
Text = "Text7"
Top = 6000
Width = 1455
End
End
Attribute VB_Name = "frm_ZCYD"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim I, a, aa, c, B
'Public adoCon As New ADODB.Connection
'Public adoRs As New ADODB.Recordset
Private Sub Combo1_Click()
If Combo1.Text = "移动时间" Then
Text1.Visible = False
DTPicker2.Visible = True
aa = DTPicker2.Value
Text1.Text = aa
Else
Text1.Visible = True
DTPicker2.Visible = False
End If
End Sub
Private Sub Combo2_Click()
If Combo2.Text <> " Like" Then
I = 0
ElseIf Combo2.Text = "Like" Then
I = 1
Else
End If
End Sub
Private Sub Combo3_Click()
Combo4.SetFocus
End Sub
Private Sub Combo4_Click()
DTPicker1.SetFocus
End Sub
Private Sub Command1_Click()
If Text1.Text = "" Then
MsgBox "输入不能为空", , "提示"
Text1.SetFocus
Else
If Combo1.Text = "资产设备编号" Then
If Asc(Text1.Text) < 48 Or Asc(Text1.Text) > 57 Then
MsgBox "输入数据非法!!", , "提示"
Text1.Text = ""
Text1.SetFocus
Else
End If
ElseIf Combo1.Text = "数量" Then
If Asc(Text1.Text) < 48 Or Asc(Text1.Text) > 57 Then
MsgBox "输入数据非法!!", , "提示"
Text1.Text = ""
Text1.SetFocus
Else
End If
End If
Dim a, aa
a = Text1.Text
If I = 0 Then
If Combo1.Text = "移动时间" Then
Text1.Visible = False
DTPicker2.Visible = True
aa = DTPicker2.Value
Text1.Text = aa
Adodc1.RecordSource = "select * from Table_ZCYD where " + Combo1.Text + " " + Combo2 + " '" + a + "'"
Adodc1.Refresh
Else
Adodc1.RecordSource = "select * from Table_ZCYD where " + Combo1.Text + " " + Combo2 + " '" + a + "'"
Adodc1.Refresh
End If
ElseIf I = 1 Then
If Combo1.Text = "移动时间" Then
Text1.Visible = False
DTPicker2.Visible = True
aa = DTPicker2.Value
Text1.Text = aa
'Adodc1.RecordSource = "select * from Table_ZCYD where " + Combo1.Text + "Like'%" + a + "%'"
Adodc1.Refresh
Else
Adodc1.RecordSource = "select * from Table_ZCYD where " + Combo1.Text + " Like '%" + a + "%'"
Adodc1.Refresh
End If
Else
End If
End If
End Sub
Private Sub Command10_Click()
Text6.Text = ""
Combo4.Text = ""
Text15.Text = ""
Combo4.SetFocus
End Sub
Private Sub Command11_Click()
frm_BMWH.Show
End Sub
Private Sub Command2_Click()
Adodc1.RecordSource = "select * from Table_ZCYD"
Adodc1.Refresh
End Sub
'Private Sub Command3_Click() '资产移动信息编辑
' Set adoCon = New ADODB.Connection
' adoCon.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=Data_MRSOFT;Data Source=MRVB"
'
'If Command3.Caption = "编辑" Then
'Command3.Caption = "保存"
'Adodc1.RecordSource = "select * from Table_ZCYD where 资产设备编号='" + Text2.Text + "'"
'Adodc1.Refresh
' If Adodc1.Recordset.RecordCount > 0 Then
' Text2.Text = Adodc1.Recordset.Fields("资产设备编号")
' Text3.Text = Adodc1.Recordset.Fields("资产名称")
' Text4.Text = Adodc1.Recordset.Fields("型号")
' Text5.Text = Adodc1.Recordset.Fields("配置")
' Text15.Text = Adodc1.Recordset.Fields("数量")
' DTPicker1.Value = Adodc1.Recordset.Fields("移动时间")
' Text6.Text = Adodc1.Recordset.Fields("移出部门")
' Combo4.Text = Adodc1.Recordset.Fields("移入部门")
' Else
' End If
'
'ElseIf Command3.Caption = "保存" Then
'Adodc1.RecordSource = "select * from Table_ZCYD where 资产设备编号='" + Text2.Text + "'"
'Adodc1.Refresh
' If Adodc1.Recordset.RecordCount > 0 Then
'Adodc1.Recordset.Delete
'Set adoRs = adoCon.Execute("insert into Table_ZCYD values(" & Text2 & ",'" & Text3 & "','" & Text4 & "','" & Text5 & "','" & Text15 & "','" & DTPicker1 & "','" & Text6 & "','" & Combo4 & "')")
' MsgBox "数据保存成功!!", , "提示"
'Command3.Caption = "编辑"
'Else
'End If
'Else
'End If
'
'End Sub
Private Sub Command4_Click() '打印资产移动信息
DataEnvironment1.rsCommand4.Open "select * from Table_ZCYD where 资产设备编号 like '" + Text8.Text + "'+ '%'order by 资产设备编号"
If DataEnvironment1.rsCommand4.RecordCount > 0 Then
DataRep_ZCYD.Show
Else
MsgBox "此设备编号不存在,请确认后重新输入"
DataEnvironment1.rsCommand4.Close
End If
End Sub
Private Sub Command5_Click()
CommonDialog1.ShowPrinter
End Sub
Private Sub Command6_Click()
frm_ZCYD.Hide
End Sub
Private Sub Command9_Click() '资产移动信息保存
' Set adoCon = New ADODB.Connection
' adoCon.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=Data_MRSOFT;Data Source=MRVB"
Call main
Dim aa As Integer
If Combo4.Text = "" Then
MsgBox "请输入移出部门", , "提示"
ElseIf Text6.Text = "" Then
MsgBox "请输入移入部门", , "提示"
ElseIf Text15.Text = "" Then
MsgBox "请输入移动数量", , "提示"
Else
If Val(Trim(Text15.Text)) > Val(Trim(Text7.Text)) Then
MsgBox "固定资产的移动数量不能大于实际固定资产的总数,请您重新输入", 32, "通用固定资产设备管理系统"
Text15.Text = ""
Text15.SetFocus
Else
Set adoRs = adoCon.Execute("insert into Table_ZCYD values(" & Text2 & ",'" & Text3 & "','" & Text4 & "','" & Text5 & "','" & Text15 & "','" & DTPicker1 & "','" & Text6 & "','" & Combo4 & "')")
Text7.Text = Val(Text7.Text) - Val(Text15.Text)
Set adoRs = adoCon.Execute("UPDATE Table_ZCXX SET 数量= '" + Text7.Text + "' where 资产设备编号='" + Text2.Text + "'")
aa = Val(Adodc2.Recordset.Fields("数量")) - Val(Text15.Text)
Set adoRs = adoCon.Execute("UPDATE Table_ZCXX SET 移动数量='" + Text15.Text + "',数量= '" + Str(aa) + "' where 资产设备编号='" + Text2.Text + "'")
MsgBox "数据保存成功!!", , "提示"
Adodc1.Refresh
Combo4.Text = ""
Text6.Text = ""
End If
End If
adoCon.Close
End Sub
Private Sub DTPicker1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text15.SetFocus
ElseIf KeyCode = 39 Then
Text15.SetFocus
End If
End Sub
Private Sub Form_Activate()
Text1.Visible = True
DTPicker2.Visible = False
Combo4.SetFocus
If Combo2.Text = " >" Then
a = 0
ElseIf Combo2.Text = " =" Then
a = 1
ElseIf Combo2.Text = " <" Then
a = 2
Else
End If
Combo4.Clear
frm_BMWH.Adodc1.RecordSource = "select * from Table_BMB"
frm_BMWH.Adodc1.Refresh
Do While frm_BMWH.Adodc1.Recordset.EOF = False
tep1 = frm_BMWH.Adodc1.Recordset.Fields("部门名称").Value
If tep1 <> tep2 Then
Combo4.AddItem (tep1)
tep2 = tep1
frm_BMWH.Adodc1.Recordset.MoveNext
ElseIf tep1 = tep2 Then
frm_BMWH.Adodc1.Recordset.MoveNext
End If
Loop
End Sub
Private Sub Text15_LostFocus()
Dim StrInput, Temp As String
Dim I, Length As Integer
I = 1
StrInput = Text15.Text
Length = Len(StrInput)
If Text15.Text = "" Then
MsgBox "输入不能为空", , "提示"
Text15.SetFocus
Else
Do While (I <= Length)
Temp = Mid$(StrInput, I, 1)
If Asc(Temp) < 48 Or Asc(Temp) > 57 Then
If I = 1 Then
MsgBox "输入数据非法!!", , "提示"
Else
End If
Text15.Text = ""
Text15.SetFocus
Else
End If
I = I + 1
Loop
If Text15.Text = "" Then
Text15.SetFocus
Else
If Val(Trim(Text15.Text)) > Val(Trim(Text7.Text)) Then
MsgBox "固定资产的移动数量不能大于实际固定资产的总数,请您重新输入", 32, "通用固定资产设备管理系统"
Text15.Text = ""
Text15.SetFocus
Else
End If
End If
End If
End Sub
Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Adodc2.RecordSource = "select * from Table_ZCXX where 资产设备编号='" + Text2.Text + "'"
Adodc2.Refresh
Combo4.SetFocus
ElseIf KeyCode = 39 Then
Combo4.SetFocus
Else
End If
End Sub
Private Sub Text3_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
' Adodc2.RecordSource = "select * from Table_ZCXX where 资产设备名称='" + Text3.Text + "'"
' Adodc2.Refresh
Combo4.SetFocus
ElseIf KeyCode = 39 Then
Combo4.SetFocus
End If
End Sub
Private Sub Text6_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
DTPicker1.SetFocus
ElseIf KeyCode = 39 Then
DTPicker1.SetFocus
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -