frmcarWXlr.frm
资源名称:0123..rar [点击查看]
上传用户:naidiweb
上传日期:2013-08-15
资源大小:672k
文件大小:24k
源码类别:
软件设计/软件工程
开发平台:
WORD
- VERSION 5.00
- Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
- Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
- Begin VB.Form frmcarWXlr
- BorderStyle = 1 'Fixed Single
- Caption = "车辆维修列表"
- ClientHeight = 2775
- ClientLeft = 45
- ClientTop = 330
- ClientWidth = 8400
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MDIChild = -1 'True
- MinButton = 0 'False
- ScaleHeight = 2775
- ScaleWidth = 8400
- Begin VB.CommandButton Command1
- Caption = "上一条"
- Height = 330
- Index = 1
- Left = 1155
- TabIndex = 32
- Top = 2340
- Width = 1095
- End
- Begin VB.CommandButton Command1
- Caption = "下一条"
- Height = 330
- Index = 2
- Left = 2250
- TabIndex = 31
- Top = 2340
- Width = 1095
- End
- Begin VB.CommandButton cmdDelete
- Caption = "删 除(&D)"
- Height = 330
- Left = 2250
- TabIndex = 30
- Top = 1950
- Width = 1095
- End
- Begin VB.CommandButton cmdUpdate
- Caption = "修 改(&U)"
- Height = 330
- Left = 1155
- TabIndex = 29
- Top = 1950
- Width = 1095
- End
- Begin VB.CommandButton Command1
- Caption = "首记录"
- Height = 330
- Index = 0
- Left = 60
- TabIndex = 28
- Top = 2340
- Width = 1095
- End
- Begin VB.CommandButton Command1
- Caption = "尾记录"
- Height = 330
- Index = 3
- Left = 3345
- TabIndex = 27
- Top = 2340
- Width = 1095
- End
- Begin VB.CommandButton cmdok
- Caption = "确 定(&O)"
- Enabled = 0 'False
- Height = 330
- Left = 4890
- TabIndex = 18
- Top = 2340
- Width = 1095
- End
- Begin VB.CommandButton cmdFind
- BackColor = &H80000004&
- Caption = "查询 (&F)"
- Height = 330
- Left = 3345
- Style = 1 'Graphical
- TabIndex = 26
- Top = 1950
- Width = 1095
- End
- Begin MSAdodcLib.Adodc Adodc1
- Height = 330
- Left = 2730
- Top = 270
- Visible = 0 'False
- Width = 1800
- _ExtentX = 3175
- _ExtentY = 582
- ConnectMode = 0
- CursorLocation = 3
- IsolationLevel = -1
- ConnectionTimeout= 15
- CommandTimeout = 30
- CursorType = 3
- LockType = 3
- CommandType = 1
- CursorOptions = 0
- CacheSize = 50
- MaxRecords = 0
- BOFAction = 0
- EOFAction = 0
- ConnectStringType= 1
- Appearance = 1
- BackColor = -2147483643
- ForeColor = -2147483640
- Orientation = 0
- Enabled = -1
- Connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=clgl.mdb;Persist Security Info=False"
- OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=clgl.mdb;Persist Security Info=False"
- OLEDBFile = ""
- DataSourceName = ""
- OtherAttributes = ""
- UserName = ""
- Password = ""
- RecordSource = "select * from 车辆维修表"
- Caption = "Adodc1"
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- _Version = 393216
- End
- Begin VB.CommandButton cmdAdd
- Caption = "添 加(&A)"
- Height = 330
- Left = 60
- TabIndex = 17
- Top = 1950
- Width = 1095
- End
- Begin VB.CommandButton cmdCancel
- Caption = "取 消(&Q)"
- Enabled = 0 'False
- Height = 330
- Left = 5985
- TabIndex = 16
- Top = 2340
- Width = 1095
- End
- Begin VB.CommandButton cmdExit
- Caption = " 退 出(&E)"
- Height = 330
- Left = 7200
- TabIndex = 15
- Top = 2340
- Width = 1095
- End
- Begin VB.Frame Frame1
- Height = 1890
- Left = 60
- TabIndex = 0
- Top = 75
- Width = 8220
- Begin VB.ComboBox Combo3
- BackColor = &H00FFFFFF&
- DataField = "更换零件3"
- DataSource = "Adodc1"
- Enabled = 0 'False
- Height = 300
- Left = 1260
- TabIndex = 23
- Text = "combo3"
- Top = 1500
- Width = 1920
- End
- Begin VB.TextBox Tc3
- BackColor = &H00FFFFFF&
- DataField = "零件3数量"
- DataSource = "Adodc1"
- Enabled = 0 'False
- Height = 270
- Left = 3780
- TabIndex = 22
- Text = "tc3"
- ToolTipText = "零件数量"
- Top = 1500
- Width = 420
- End
- Begin VB.CommandButton cmdT
- Caption = "统计(&T)"
- Height = 285
- Left = 6855
- TabIndex = 21
- Top = 660
- Width = 1155
- End
- Begin VB.ComboBox Combo1
- BackColor = &H00FFFFFF&
- DataField = "更换零件1"
- DataSource = "Adodc1"
- Enabled = 0 'False
- Height = 300
- Left = 1260
- TabIndex = 20
- Text = "combo1"
- ToolTipText = "选择零件名"
- Top = 675
- Width = 1920
- End
- Begin VB.TextBox Tc1
- BackColor = &H00FFFFFF&
- DataField = "零件1数量"
- DataSource = "Adodc1"
- Enabled = 0 'False
- Height = 270
- Left = 3780
- TabIndex = 19
- Text = "tc1"
- ToolTipText = "零件数量"
- Top = 675
- Width = 420
- End
- Begin VB.TextBox Tc2
- BackColor = &H00FFFFFF&
- DataField = "零件2数量"
- DataSource = "Adodc1"
- Enabled = 0 'False
- Height = 270
- Left = 3780
- TabIndex = 13
- Text = "tc2"
- ToolTipText = "零件数量"
- Top = 1065
- Width = 420
- End
- Begin VB.ComboBox Combo2
- BackColor = &H00FFFFFF&
- DataField = "更换零件2"
- DataSource = "Adodc1"
- Enabled = 0 'False
- Height = 300
- Left = 1260
- TabIndex = 11
- Text = "combo2"
- Top = 1080
- Width = 1920
- End
- Begin VB.TextBox Text6
- BackColor = &H00FFFFFF&
- DataField = "备注"
- DataSource = "Adodc1"
- Enabled = 0 'False
- Height = 705
- Left = 5355
- MultiLine = -1 'True
- ScrollBars = 2 'Vertical
- TabIndex = 10
- Text = "frmcarWXlr.frx":0000
- ToolTipText = "备注"
- Top = 1075
- Width = 2685
- End
- Begin VB.TextBox Text5
- BackColor = &H00FFFFFF&
- DataField = "共计费用"
- DataSource = "Adodc1"
- Enabled = 0 'False
- ForeColor = &H00400040&
- Height = 285
- Left = 5355
- TabIndex = 9
- Text = "text5"
- ToolTipText = "修理费用"
- Top = 650
- Width = 1320
- End
- Begin MSComCtl2.DTPicker DTPicker1
- DataField = "维修日期"
- Height = 285
- Left = 5370
- TabIndex = 8
- Top = 210
- Width = 1320
- _ExtentX = 2328
- _ExtentY = 503
- _Version = 393216
- Enabled = 0 'False
- CalendarTitleBackColor= 16761087
- Format = 65994753
- CurrentDate = 38324
- End
- Begin VB.TextBox Text1
- BackColor = &H00FFFFFF&
- DataField = "车牌号码"
- DataSource = "Adodc1"
- Enabled = 0 'False
- Height = 270
- Left = 1275
- TabIndex = 7
- Text = "text1"
- ToolTipText = "输入车牌号码"
- Top = 225
- Width = 1425
- End
- Begin MSAdodcLib.Adodc Adodc2
- Height = 330
- Left = 6780
- Top = 180
- Visible = 0 'False
- Width = 1770
- _ExtentX = 3122
- _ExtentY = 582
- ConnectMode = 0
- CursorLocation = 3
- IsolationLevel = -1
- ConnectionTimeout= 15
- CommandTimeout = 30
- CursorType = 3
- LockType = 3
- CommandType = 1
- CursorOptions = 0
- CacheSize = 50
- MaxRecords = 0
- BOFAction = 0
- EOFAction = 0
- ConnectStringType= 1
- Appearance = 1
- BackColor = -2147483643
- ForeColor = -2147483640
- Orientation = 0
- Enabled = -1
- Connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=clgl.mdb;Persist Security Info=False"
- OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=clgl.mdb;Persist Security Info=False"
- OLEDBFile = ""
- DataSourceName = ""
- OtherAttributes = ""
- UserName = ""
- Password = ""
- RecordSource = "select * from 零件表"
- Caption = "Adodc2"
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- _Version = 393216
- End
- Begin VB.Label Label4
- Caption = "更换零件3:"
- Height = 270
- Left = 210
- TabIndex = 25
- Top = 1500
- Width = 1170
- End
- Begin VB.Label Label10
- Caption = "数量:"
- Height = 240
- Left = 3240
- TabIndex = 24
- Top = 1545
- Width = 585
- End
- Begin VB.Label Label9
- Caption = "数量:"
- Height = 240
- Left = 3240
- TabIndex = 14
- Top = 1110
- Width = 585
- End
- Begin VB.Label Label8
- Caption = "数量:"
- Height = 240
- Left = 3240
- TabIndex = 12
- Top = 690
- Width = 585
- End
- Begin VB.Label Label7
- Caption = "备注:"
- Height = 270
- Left = 4515
- TabIndex = 6
- Top = 1080
- Width = 990
- End
- Begin VB.Label Label6
- Caption = "共计费用:"
- Height = 270
- Left = 4515
- TabIndex = 5
- Top = 645
- Width = 990
- End
- Begin VB.Label Label5
- Caption = "维修日期:"
- Height = 270
- Left = 4515
- TabIndex = 4
- Top = 225
- Width = 990
- End
- Begin VB.Label Label3
- Caption = "更换零件2:"
- Height = 270
- Left = 180
- TabIndex = 3
- Top = 1080
- Width = 1170
- End
- Begin VB.Label Label2
- Caption = "更换零件1:"
- Height = 270
- Left = 210
- TabIndex = 2
- Top = 650
- Width = 1170
- End
- Begin VB.Label Label1
- Caption = "车牌号码:"
- Height = 270
- Left = 210
- TabIndex = 1
- Top = 225
- Width = 990
- End
- End
- End
- Attribute VB_Name = "frmcarWXlr"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Dim i As Integer
- Private Sub cmdAdd_Click()
- Unlockctl
- DTPicker1.Value = Format(Now, "yyyy-mm-dd")
- Text1 = "": Tc1 = ""
- Tc2 = "": Tc3 = ""
- Text5 = "": Text6 = ""
- TextDTP = "": Combo1.Text = ""
- Combo2.Text = "": Combo3.Text = ""
- Text1.SetFocus
- cmdOk.Enabled = False: cmdCancel.Enabled = True
- cmdUpdate.Enabled = False: cmdDelete.Enabled = False
- Combo1.Visible = True: Adodc1.Enabled = False
- cmdT.Enabled = True
- i = 1
- End Sub
- Private Sub cmdCancel_Click()
- On Error Resume Next '当没有添加数据的时候 处理异常
- Adodc1.Recordset.CancelUpdate
- Adodc1.Refresh
- Lockctl
- cmdOk.Enabled = False: cmdCancel.Enabled = False
- cmdAdd.Enabled = True: cmdUpdate.Enabled = True
- cmdDelete.Enabled = True: Adodc1.Enabled = True
- cmdT.Enabled = False
- End Sub
- Private Sub cmdDelete_Click()
- If MsgBox("您确实要删除记录吗?", vbOKCancel, "系统提示") = vbOK Then
- 'adoCon.Execute ("delete from 车辆维修表 where 车牌号码='" & Text1 & "'")
- On Error Resume Next
- Adodc1.Recordset.Delete
- MsgBox " 记录已删除!", , "系统提示"
- Adodc1.Refresh
- End If
- End Sub
- Private Sub cmdExit_Click()
- MDIForm1.StatusBar1.Panels(1).Text = ""
- Unload Me
- End Sub
- Private Sub cmdFind_Click()
- Dim str As String
- str = InputBox$("输入你要查询的车牌号码:", "系统提示")
- If str = "" Then Exit Sub
- Adodc1.RecordSource = "select * from 车辆维修表 where 车牌号码='" + str + "'"
- Adodc1.Refresh
- If Adodc1.Recordset.RecordCount > 0 Then
- Text1.Text = Adodc1.Recordset.Fields(0)
- Combo1.Text = Adodc1.Recordset.Fields(1)
- Tc1.Text = Adodc1.Recordset.Fields(2)
- Combo2.Text = Adodc1.Recordset.Fields(3)
- Tc2.Text = Adodc1.Recordset.Fields(4)
- Combo3.Text = Adodc1.Recordset.Fields(5)
- Tc3.Text = Adodc1.Recordset.Fields(6)
- DTPicker1.Value = Adodc1.Recordset.Fields(7)
- Text5.Text = Adodc1.Recordset.Fields(8)
- Text6.Text = Adodc1.Recordset.Fields(9)
- cmdUpdate.Enabled = True
- cmdDelete.Enabled = True
- Else
- MsgBox "没有你需要的信息!", , "系统提示"
- cmdUpdate.Enabled = False
- cmdDelete.Enabled = False
- End If
- End Sub
- Private Sub cmdOk_Click()
- Select Case i
- Case 1
- If Text1 = "" Then
- MsgBox "车牌号码不能为空", , "系统提示"
- Text1.SetFocus
- Exit Sub
- End If
- adoCon.Execute ("insert into 车辆维修表 values ('" & Text1 & "','" & Combo1.Text & "','" & Tc1.Text & "','" & Combo2.Text & "','" & Tc2.Text & "','" & Combo3.Text & "','" & Tc3.Text & "','" & DTPicker1.Value & "','" & Text5.Text & "','" & Text6.Text & "')")
- MsgBox "记录添加成功!", , "系统提示"
- Adodc1.Refresh
- Case 2
- ' adoCon.Execute ("update 车辆维修表 set 更换零件1='" & Combo1 & "',零件1数量='" & Tc1.Text & "',更换零件2='" & Combo2 & "',零件2数量='" & Tc2.Text & "',更换零件3='" & Combo3.Text & "', 零件3数量='" & Tc3.Text & "',维修日期='" & DTPicker1.Value & "',共计费用='" & Text5.Text & "',备注='" & Text6.Text & "' where 车牌号码='" & Text1 & "'")
- On Error Resume Next
- Adodc1.Recordset.Update
- MsgBox "记录修改成功!", , "系统提示"
- Adodc1.Refresh
- End Select
- Lockctl
- cmdOk.Enabled = False: cmdCancel.Enabled = False
- cmdAdd.Enabled = True: cmdUpdate.Enabled = True
- cmdDelete.Enabled = True: Adodc1.Enabled = True
- cmdT.Enabled = False
- End Sub
- Private Sub cmdT_Click()
- Dim c1, c2, c3 As Integer
- On Error Resume Next
- Adodc2.RecordSource = "select 单价 from 零件表 where 零件名='" & Combo1.Text & "'"
- Adodc2.Refresh
- c1 = Val(Adodc2.Recordset.Fields(0)) * Val(Tc1.Text)
- Adodc2.RecordSource = "select 单价 from 零件表 where 零件名='" & Combo2.Text & "'"
- Adodc2.Refresh
- c2 = Val(Adodc2.Recordset.Fields(0)) * Val(Tc2.Text)
- Adodc2.RecordSource = "select 单价 from 零件表 where 零件名='" & Combo3.Text & "'"
- Adodc2.Refresh
- c3 = Val(Adodc2.Recordset.Fields(0)) * Val(Tc3.Text)
- Text5.Text = c1 + c2 + c3
- cmdOk.Enabled = True
- End Sub
- Private Sub cmdUpdate_Click()
- Unlockctl
- i = 2
- cmdOk.Enabled = True: cmdCancel.Enabled = True
- cmdAdd.Enabled = False: cmdDelete.Enabled = False
- Adodc1.Enabled = False: Text1.Enabled = False
- cmdT.Enabled = True
- End Sub
- Private Sub Combo1_KeyPress(KeyAscii As Integer)
- KeyAscii = valiText(KeyAscii, Chr(13), True)
- End Sub
- Private Sub Combo2_KeyPress(KeyAscii As Integer)
- KeyAscii = valiText(KeyAscii, Chr(13), True)
- End Sub
- Private Sub Combo3_KeyDown(KeyCode As Integer, Shift As Integer)
- If KeyCode = vbKeyReturn Then Tc3.SetFocus
- End Sub
- Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
- If KeyCode = vbKeyReturn Then Tc1.SetFocus
- End Sub
- Private Sub Combo2_KeyDown(KeyCode As Integer, Shift As Integer)
- If KeyCode = vbKeyReturn Then Tc2.SetFocus
- End Sub
- Private Sub Combo3_KeyPress(KeyAscii As Integer)
- KeyAscii = valiText(KeyAscii, Chr(13), True)
- End Sub
- Private Sub Command1_Click(Index As Integer)
- On Error Resume Next
- Select Case Index
- Case 0
- Adodc1.Recordset.MoveFirst
- Case 1
- If Adodc1.Recordset.BOF = False Then
- Adodc1.Recordset.MovePrevious
- Else
- MsgBox "向前已经没有记录了!", , "系统提示"
- End If
- Case 2
- If Adodc1.Recordset.EOF = False Then
- Adodc1.Recordset.MoveNext
- Else
- MsgBox "向后已经没有记录了!", , "系统提示"
- End If
- Case 3
- Adodc1.Recordset.MoveLast
- End Select
- Text1.Text = Adodc1.Recordset.Fields(0)
- Combo1.Text = Adodc1.Recordset.Fields(1)
- Tc1.Text = Adodc1.Recordset.Fields(2)
- Combo2.Text = Adodc1.Recordset.Fields(3)
- Tc2.Text = Adodc1.Recordset.Fields(4)
- Combo3.Text = Adodc1.Recordset.Fields(5)
- Tc3.Text = Adodc1.Recordset.Fields(6)
- DTPicker1.Value = Adodc1.Recordset.Fields(7)
- Text5.Text = Adodc1.Recordset.Fields(8)
- Text6.Text = Adodc1.Recordset.Fields(9)
- End Sub
- Private Sub Form_Load()
- frmcarWXlr.Width = 8490
- frmcarWXlr.Height = 3150
- Adodc1.RecordSource = "select * from 车辆维修表"
- Adodc1.Refresh
- If Adodc1.Recordset.RecordCount > 0 Then DTPicker1.Value = Adodc1.Recordset.Fields("维修日期").Value
- Adodc2.RecordSource = "select * from 零件表"
- Adodc2.Refresh
- For i = 0 To Adodc2.Recordset.RecordCount - 1
- Combo1.AddItem Adodc2.Recordset.Fields(0).Value
- Combo2.AddItem Adodc2.Recordset.Fields(0).Value
- Combo3.AddItem Adodc2.Recordset.Fields(0).Value
- Adodc2.Recordset.MoveNext
- Next
- If Adodc1.Recordset.RecordCount = 0 Then Exit Sub
- Combo1.Text = Adodc1.Recordset.Fields(2)
- Combo2.Text = Adodc1.Recordset.Fields(4)
- Combo3.Text = Adodc1.Recordset.Fields(6)
- cmdT.Enabled = False
- End Sub
- Private Sub Lockctl()
- Text1.Enabled = False: Combo1.Enabled = False
- Combo2.Enabled = False: Combo3.Enabled = False
- Tc1.Enabled = False: Tc2.Enabled = False
- Text5.Enabled = False: Text6.Enabled = False
- DTPicker1.Enabled = False: Tc3.Enabled = False
- End Sub
- Private Sub Unlockctl()
- Text1.Enabled = True: Combo1.Enabled = True
- Combo2.Enabled = True: Combo3.Enabled = True
- Tc1.Enabled = True: Tc2.Enabled = True
- Tc3.Enabled = True: Text6.Enabled = True
- DTPicker1.Enabled = True
- End Sub
- Private Sub Tc1_KeyDown(KeyCode As Integer, Shift As Integer)
- If KeyCode = vbKeyReturn Then
- If Tc1.Text = "" Then
- If Combo1.Text <> "" Then
- MsgBox "请添加零件数量", , "系统提示"
- Exit Sub
- End If
- End If
- Combo2.SetFocus
- End If
- End Sub
- Private Sub Tc1_KeyPress(KeyAscii As Integer)
- KeyAscii = valiText(KeyAscii, "0123456789." & Chr(8), True)
- End Sub
- Private Sub Tc2_KeyPress(KeyAscii As Integer)
- KeyAscii = valiText(KeyAscii, "0123456789" & Chr(8), True)
- End Sub
- Private Sub Tc3_KeyPress(KeyAscii As Integer)
- KeyAscii = valiText(KeyAscii, "0123456789." & Chr(8), True)
- End Sub
- Private Sub Tc2_KeyDown(KeyCode As Integer, Shift As Integer)
- If KeyCode = vbKeyReturn Then
- If Tc2.Text = "" Then
- If Combo2.Text <> "" Then
- MsgBox "请添加零件数量", , "系统提示"
- Exit Sub
- End If
- End If
- Combo3.SetFocus
- End If
- End Sub
- Private Sub Tc3_KeyDown(KeyCode As Integer, Shift As Integer)
- If KeyCode = vbKeyReturn Then
- If Tc3.Text = "" Then
- If Combo3.Text <> "" Then
- MsgBox "请添加零件数量", , "系统提示"
- Exit Sub
- End If
- End If
- End If
- End Sub
- Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
- If KeyCode = vbKeyReturn Then
- If Text1.Text = "" Then
- MsgBox "车牌号码不能为空!", , "系统提示"
- Text1.SetFocus
- Exit Sub
- End If
- Combo1.SetFocus
- End If
- End Sub
- Private Sub Text1_LostFocus()
- If Text1.Text = "" Then Exit Sub
- Dim rss As New ADODB.Recordset
- Set rss = adoCon.Execute("select * from 车辆档案 where 车牌号码='" & Text1.Text & "'")
- If rss.EOF Then
- MsgBox "这辆车不属于本公司的!", , "系统提示"
- Text1.Text = ""
- Text1.SetFocus
- Exit Sub
- End If
- rss.Close
- Dim rss1 As New ADODB.Recordset
- Set rss1 = adoCon.Execute("select * from 车辆异动表 where 车牌号码='" & Text1.Text & "'")
- If rss1.EOF Then
- Else
- MsgBox "该车为异动车辆!", , "系统提示"
- Text1.Text = ""
- Text1.SetFocus
- Exit Sub
- End If
- rss1.Close
- Dim rss2 As New ADODB.Recordset
- Set rss2 = adoCon.Execute("select * from 车辆报废表 where 车牌号码='" & Text1.Text & "'")
- If rss2.EOF Then
- Else
- MsgBox "该车已经报废,不能维修!", , "系统提示"
- Text1.Text = ""
- Text1.SetFocus
- Exit Sub
- End If
- rss2.Close
- End Sub
- Private Sub TextDTP_KeyDown(KeyCode As Integer, Shift As Integer)
- If KeyCode = vbKeyReturn Then Text6.SetFocus
- End Sub