📄 imjl.frm
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form imjl
Caption = "修改记录"
ClientHeight = 5400
ClientLeft = 60
ClientTop = 450
ClientWidth = 7065
LinkTopic = "Form1"
Picture = "imjl.frx":0000
ScaleHeight = 5400
ScaleWidth = 7065
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command1
Caption = "修改资产信息"
Default = -1 'True
Height = 495
Left = 1200
TabIndex = 19
Top = 4440
Width = 1335
End
Begin VB.CommandButton Command2
Caption = "放弃修改"
Height = 495
Left = 4560
TabIndex = 18
Top = 4440
Width = 1335
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
Enabled = 0 'False
Height = 270
Left = 360
TabIndex = 8
Top = 480
Width = 1815
End
Begin VB.TextBox Text2
Appearance = 0 'Flat
Height = 270
Left = 2640
TabIndex = 7
Top = 480
Width = 1815
End
Begin VB.TextBox Text3
Appearance = 0 'Flat
Height = 270
Left = 4920
TabIndex = 6
Top = 480
Width = 1815
End
Begin VB.TextBox Text4
Appearance = 0 'Flat
Height = 270
Left = 360
TabIndex = 5
Top = 1320
Width = 1815
End
Begin VB.ComboBox PartCombo
Height = 300
Left = 360
TabIndex = 4
Top = 2160
Width = 1815
End
Begin VB.TextBox Text5
Appearance = 0 'Flat
Height = 270
Left = 4920
TabIndex = 2
Top = 1320
Width = 1815
End
Begin VB.TextBox Text6
Appearance = 0 'Flat
Height = 1335
Left = 360
MaxLength = 100
MultiLine = -1 'True
TabIndex = 1
Text = "imjl.frx":A219
Top = 2880
Width = 6375
End
Begin VB.TextBox Text7
Appearance = 0 'Flat
Height = 270
Left = 2640
TabIndex = 0
Top = 1320
Width = 1815
End
Begin MSComCtl2.DTPicker DTPicker1
Height = 255
Left = 2640
TabIndex = 3
Top = 2160
Width = 1815
_ExtentX = 3201
_ExtentY = 450
_Version = 393216
Format = 21299201
CurrentDate = 39513
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "资产编号"
Height = 255
Left = 360
TabIndex = 17
Top = 240
Width = 1575
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "资产名称"
Height = 255
Left = 2640
TabIndex = 16
Top = 240
Width = 1575
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "资产数目"
Height = 255
Left = 4920
TabIndex = 15
Top = 240
Width = 1335
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
Caption = "单价(元)"
Height = 255
Left = 360
TabIndex = 14
Top = 1080
Width = 1335
End
Begin VB.Label Label5
BackStyle = 0 'Transparent
Caption = "购买部门"
Height = 255
Left = 360
TabIndex = 13
Top = 1920
Width = 1215
End
Begin VB.Label Label6
BackStyle = 0 'Transparent
Caption = "购买日期"
Height = 255
Left = 2640
TabIndex = 12
Top = 1920
Width = 1455
End
Begin VB.Label Label7
BackStyle = 0 'Transparent
Caption = "联系电话"
Height = 255
Left = 4920
TabIndex = 11
Top = 1080
Width = 1455
End
Begin VB.Label Label8
BackStyle = 0 'Transparent
Caption = "资产说明"
Height = 255
Left = 360
TabIndex = 10
Top = 2640
Width = 2055
End
Begin VB.Label Label9
BackStyle = 0 'Transparent
Caption = "经手人ID"
Height = 255
Left = 2640
TabIndex = 9
Top = 1080
Width = 1335
End
End
Attribute VB_Name = "imjl"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim sql As String
Dim rs As New ADODB.Recordset
If Text1.Text = "" Then '检查输入数据是否有效以及输入是否完整
MsgBox "资产编号不能为空!", vbCritical
Text1.SetFocus
Exit Sub
End If
If Text2.Text = "" Then
MsgBox "资产名称不能为空!", vbCritical
Text2.SetFocus
Exit Sub
End If
If Text3.Text = "" Then
MsgBox "资产数目不能为空!", vbCritical
Text3.SetFocus
Exit Sub
End If
If Text4.Text = "" Then
MsgBox "资产单价不能为空!", vbCritical
Text4.SetFocus
Exit Sub
End If
If Text7.Text = "" Then
MsgBox "经手人ID不能为空!", vbCritical
Text7.SetFocus
Exit Sub
End If
If Text5.Text = "" Then
MsgBox "联系电话不能为空!", vbCritical
Text5.SetFocus
Exit Sub
End If
If Text6.Text = "" Then
MsgBox "资产说明不能为空!", vbCritical
Text6.SetFocus
Exit Sub
End If
If Not IsNumeric(Text3.Text) Then
MsgBox "资产数目必须是数字!", vbCritical
Text3.SetFocus
Exit Sub
End If
If Not IsNumeric(Text4.Text) Then
MsgBox "资产单价必须是数字!", vbCritical
Text4.SetFocus
Exit Sub
End If
If PartCombo.ListIndex = -1 Then
MsgBox "部门必须选择!", vbCritical
PartCombo.SetFocus
Exit Sub
End If
If DbHandle.DbConnection Then
sql = "TBL_USER" '打开职工表,查询输入的职工ID是否存在
rs.CursorType = adOpenDynamic
rs.LockType = adLockOptimistic
rs.Filter = "USER_ID='" & Text7.Text & "'"
rs.Open sql, DbFinance
If DbHandle.resultcount(rs) <> 1 Then '不存在要求用户重新输入职工ID号
MsgBox "错误,不存在的ID号!", vbExclamation
Text7.SetFocus
rs.Close
Set rs = Nothing
DbHandle.DbClose
Exit Sub
End If
rs.Close
sql = "TBL_FIXED"
rs.CursorType = adOpenDynamic
rs.LockType = adLockOptimistic
rs.Filter = "FIXED_ID='" & Text1.Text & "'"
rs.Open sql, DbFinance '如果职工存在,定位固定资产表中的记录,修改记录属性值
rs("FIXED_NAME") = Text2.Text
rs("FIXED_NUM") = Val(Text3.Text)
rs("FIXED_MONEY") = Val(Text4.Text)
rs("FIXED_PART") = PartCombo.ItemData(PartCombo.ListIndex)
rs("FIXED_USER") = Text7.Text
rs("FIXED_PHONE") = Text5.Text
rs("FIXED_DATE") = DTPicker1.Value
rs("FIXED_REMARK") = Text6.Text
rs.Update
rs.Close '释放资源,提示修改成功,返回主窗体
MsgBox "固定资产信息成功修改!"
Unload Me
Else '数据库连接出错,退出
MsgBox "数据库错误!", vbExclamation
DbHandle.DbClose
End
End If
End Sub
Private Sub Command2_Click()
Unload Me '返回主窗体
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -