fixFixed.frm
上传用户:cntx88
上传日期:2022-08-07
资源大小:169k
文件大小:5k
- VERSION 5.00
- Begin VB.Form fixFixed
- Caption = "定位固定资产"
- ClientHeight = 2775
- ClientLeft = 60
- ClientTop = 450
- ClientWidth = 3780
- LinkTopic = "Form1"
- LockControls = -1 'True
- ScaleHeight = 2775
- ScaleWidth = 3780
- StartUpPosition = 3 '窗口缺省
- Begin VB.Frame Frame1
- Caption = "定位预修改的固定资产记录"
- Height = 2535
- Left = 120
- TabIndex = 0
- Top = 120
- Width = 3495
- Begin VB.TextBox FID
- Appearance = 0 'Flat
- Height = 270
- Left = 240
- TabIndex = 3
- Top = 720
- Width = 3015
- End
- Begin VB.CommandButton Command1
- Caption = "定位固定资产记录"
- Default = -1 'True
- Height = 495
- Left = 240
- TabIndex = 2
- Top = 1200
- Width = 3015
- End
- Begin VB.CommandButton Command2
- Caption = "取消修改"
- Height = 495
- Left = 240
- TabIndex = 1
- Top = 1800
- Width = 3015
- End
- Begin VB.Label Label1
- Caption = "固定资产ID编号"
- Height = 255
- Left = 240
- TabIndex = 4
- Top = 480
- Width = 1455
- End
- End
- End
- Attribute VB_Name = "fixFixed"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- Private Sub Command1_Click()
- Dim sql As String
- Dim rs As New ADODB.Recordset
- Dim i As Integer
- If FID.Text = "" Then '固定资产编号不可为空
- MsgBox "请输入固定资产编号!", vbExclamation
- FID.SetFocus
- Exit Sub
- End If
- fixFixed2.Left = (Screen.Width - fixFixed2.ScaleWidth) / 2 '修改固定资产窗体居中化
- fixFixed2.Top = (Screen.Height - fixFixed2.ScaleHeight) / 2
- If DbHandle.DbConnection Then
- sql = "TBL_PART" '提取部门表的所有静态记录
- rs.CursorType = adOpenDynamic
- rs.LockType = adLockOptimistic
- rs.Filter = ""
- rs.Open sql, DbFinance
-
- Do While rs.EOF = False '将结果集加入修改固定资产窗体的下拉列表中
- fixFixed2.PartCombo.AddItem (rs("PART_NAME"))
- fixFixed2.PartCombo.ItemData(fixFixed2.PartCombo.NewIndex) = rs("PART_ID")
- rs.MoveNext
- Loop
- rs.Close '释放数据库
- Set rs = Nothing
- DbHandle.DbClose
- Else '数据库连接无法打开,显示出错窗体,退出
- MsgBox "数据库错误!", vbExclamation
- DbHandle.DbClose
- End
- End If
-
- If DbHandle.DbConnection Then
- sql = "TBL_FIXED" '打开固定资产表,搜索定位修改的固定资产是否存在
- rs.CursorType = adOpenDynamic
- rs.LockType = adLockOptimistic
- rs.Filter = "FIXED_ID='" & FID.Text & "'"
- rs.Open sql, DbFinance
- If DbHandle.resultcount(rs) <> 1 Then '不存在,出错退出
- MsgBox "错误,不存在的固定资产记录!", vbExclamation
- FID.SetFocus
- rs.Close
- Set rs = Nothing
- DbHandle.DbClose
- Exit Sub
- End If
- '存在记录,设置修改固定资产窗体的各个元素默认值为记录的各个字段属性
- fixFixed2.Text1.Text = rs("FIXED_ID") '固定资产编号
- fixFixed2.Text2.Text = rs("FIXED_NAME") '固定资产名称
- fixFixed2.Text3.Text = Trim(Str(rs("FIXED_NUM"))) '固定资产个数
- fixFixed2.Text4.Text = Trim(Str(rs("FIXED_MONEY"))) '固定资产单价
- fixFixed2.Text5.Text = rs("FIXED_PHONE") '联系人电话
- fixFixed2.Text6.Text = rs("FIXED_REMARK") '固定资产说明
- fixFixed2.Text7.Text = rs("FIXED_USER") '经手人ID
- fixFixed2.DTPicker1.Value = rs("FIXED_DATE") '固定资产购买日期
- fixFixed2.Text7.MaxLength = 100
- fixFixed2.PartCombo.Text = ""
- For i = 0 To fixFixed2.PartCombo.ListCount - 1 '循环设置固定资产购买部门
- If fixFixed2.PartCombo.ItemData(i) = rs("FIXED_PART") Then
- fixFixed2.PartCombo.ListIndex = i
- Exit For
- End If
- Next i
- rs.Close '设置完成,释放结果集
- Set rs = Nothing
- DbHandle.DbClose
- fixFixed2.Show 1 '修改固定资产窗体显示
- Unload Me '完成固定资产修改,退出
- Else
- MsgBox "数据库错误!", vbExclamation
- DbHandle.DbClose
- End
- End If
- End Sub
- Private Sub Command2_Click()
- Me.Hide '返回主窗体
- End Sub
- Private Sub Form_Load()
- Me.Left = (Screen.Width - Me.ScaleWidth) / 2 '窗体居中显示
- Me.Top = (Screen.Height - Me.ScaleHeight) / 2
- End Sub
- Private Sub Form_Unload(Cancel As Integer)
- On Error Resume Next '窗体关闭时关闭数据库连接
- DbHandle.DbClose
- End Sub