【VB开源代码栏目提醒】:网学会员鉴于大家对VB开源代码十分关注,论文会员在此为大家搜集整理了“repair_increase.frm”一文,供大家参考学习
VERSION 5.00
Begin VB.Form repair_increase
Caption = "建立维修记录"
ClientHeight = 6615
ClientLeft = 60
ClientTop = 345
ClientWidth = 8475
LinkTopic = "Form1"
ScaleHeight = 6615
ScaleWidth = 8475
StartUpPosition = 2 '屏幕中心
Begin VB.TextBox Text9
Enabled = 0 'False
Height = 375
Left = 1920
TabIndex = 17
Top = 1920
Width = 2295
End
Begin VB.TextBox Text6
Enabled = 0 'False
Height = 375
Left = 1920
TabIndex = 16
Top = 1440
Width = 2295
End
Begin VB.TextBox Text2
Enabled = 0 'False
Height = 375
Left = 1920
TabIndex = 15
Top = 2520
Width = 1095
End
Begin VB.TextBox Text3
Enabled = 0 'False
Height = 375
Left = 1920
TabIndex = 14
Top = 840
Width = 2295
End
Begin VB.TextBox Text4
Enabled = 0 'False
Height = 375
Left = 5760
TabIndex = 13
Top = 2520
Width = 1815
End
Begin VB.TextBox Text5
Enabled = 0 'False
Height = 375
Left = 1920
TabIndex = 12
Top = 3120
Width = 2175
End
Begin VB.TextBox Text8
Enabled = 0 'False
Height = 375
Left = 5880
TabIndex = 11
Top = 840
Width = 1695
End
Begin VB.TextBox Text7
Enabled = 0 'False
Height = 375
Left = 1920
TabIndex = 10
Top = 3840
Width = 2175
End
Begin VB.TextBox Text11
Height = 615
Left = 1920
MultiLine = -1 'True
TabIndex = 9
Top = 4440
Width = 5655
End
Begin VB.TextBox Text1
Height = 375
Left = 3360
TabIndex = 0
Top = 240
Width = 2295
End
Begin VB.CommandButton Command1
Caption = "确认"
Height = 375
Left = 6240
TabIndex = 4
Top = 240
Width = 975
End
Begin VB.CommandButton Command2
Caption = "确认"
Height = 495
Left = 3600
TabIndex = 3
Top = 5760
Width = 1095
End
Begin VB.TextBox Text10
Height = 375
Left = 1920
TabIndex = 2
Top = 5280
Width = 1455
End
Begin VB.CommandButton Command4
Caption = "取消"
Height = 495
Left = 5280
TabIndex = 1
Top = 5760
Width = 1095
End
Begin
VB.Label Label7
Caption = "目前状态:"
Height = 375
Left = 4800
TabIndex = 26
Top = 3840
Width = 1575
End
Begin VB.Label Label2
Caption = "类别:"
Height = 375
Left = 600
TabIndex = 25
Top = 1440
Width = 1215
End
Begin VB.Label Label3
Caption = "名称"
Height = 375
Left = 600
TabIndex = 24
Top = 840
Width = 1095
End
Begin VB.Label Label4
Caption = "折旧率:"
Height = 375
Left = 600
TabIndex = 23
Top = 2640
Width = 855
End
Begin VB.Label Label5
Caption = "购买日期:"
Height = 375
Left = 600
TabIndex = 22
Top = 3240
Width = 1095
End
Begin VB.Label Label6
Caption = "价格:"
Height = 375
Left = 5040
TabIndex = 21
Top = 2520
Width = 1095
End
Begin VB.Label Label9
Caption = "型号:"
Height = 375
Left = 5040
TabIndex = 20
Top = 840
Width = 1095
End
Begin VB.Label Label10
Caption = "所属系部:"
Height = 375
Left = 600
TabIndex = 19
Top = 2040
Width = 1215
End
Begin VB.Label Label8
Caption = "进库日期:"
Height = 375
Left = 600
TabIndex = 18
Top = 3840
Width = 1095
End
Begin VB.Label Label1
Caption = "设备编号:"
Height = 375
Left = 2040
TabIndex = 8
Top = 240
Width = 1095
End
Begin VB.Label Label11
ForeColor = &H000000FF&
Height = 375
Left = 6600
TabIndex = 7
Top = 3840
Width = 735
End
Begin VB.Label Label12
Caption = "故障:"
Height = 375
Left = 600
TabIndex = 6
Top = 4560
Width = 1095
End
Begin VB.Label Label13
Caption = "经手人:"
Height = 375
Left = 600
TabIndex = 5
Top = 5280
Width = 975
End
End
Attribute VB_Name = "repair_increase"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & App.Path & "\file.mdb;Persist Security Info=False"
sql = "select * from info_device where dno='" & Text1.Text & "'"
rs.Open sql, cn, 1, 1
If rs.EOF = True Then
MsgBox "没有找到该设备编号"
Else
Text3.Text = rs("dname")
Text8.Text = rs("dmodule")
Text6.Text = rs("dtype")
Text9.Text = rs("ddept")
Text2.Text = rs("dzj")
Text4.Text = rs("dprice")
Text5.Text = rs("dbdate")
Text7.Text = rs("ddate")
If rs("dflag") = 1 Then
Label11.Caption = "在库"
Else
rs.Close
Label11.Caption = "不在库"
End If
End If
End Sub
Private Sub Command2_Click()
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & App.Path & "\file.mdb;Persist Security Info=False"
sql = "select * from repair where dno='" & Text1.Text & "'"
rs.Open
sql, cn, 1, 1
If rs.EOF <> True Then
MsgBox "该设备已经在维修表中"
Else
rs.Close
sql = "select * from repair "
rs.Open sql, cn, 3, 2
rs.AddNew
rs("dno") = Trim(Text1.Text)
rs("rprob") = Trim(Text11.Text)
rs("operator") = Trim(Text10.Text)
rs("date") = Format(Now, "yyyymmdd")
rs.Update
MsgBox "已经为该设备建立维修记录"
End If
End Sub