frmcarWZlr.frm
资源名称:0123..rar [点击查看]
上传用户:naidiweb
上传日期:2013-08-15
资源大小:672k
文件大小:16k
源码类别:
软件设计/软件工程
开发平台:
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 frmcarWZlr
- BorderStyle = 3 'Fixed Dialog
- Caption = "车辆违章记录"
- ClientHeight = 2415
- ClientLeft = 45
- ClientTop = 330
- ClientWidth = 6630
- ForeColor = &H80000001&
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MDIChild = -1 'True
- MinButton = 0 'False
- ScaleHeight = 2415
- ScaleWidth = 6630
- ShowInTaskbar = 0 'False
- Begin VB.CommandButton Command1
- Caption = "尾记录"
- Enabled = 0 'False
- Height = 330
- Index = 3
- Left = 3720
- TabIndex = 21
- Top = 1605
- Width = 915
- End
- Begin VB.CommandButton Command1
- Caption = "下一条"
- Enabled = 0 'False
- Height = 330
- Index = 2
- Left = 2820
- TabIndex = 22
- Top = 1605
- Width = 915
- End
- Begin VB.CommandButton Command1
- Caption = "上一条"
- Enabled = 0 'False
- Height = 330
- Index = 1
- Left = 1920
- TabIndex = 23
- Top = 1605
- Width = 915
- End
- Begin VB.CommandButton Command1
- Caption = "首记录"
- Enabled = 0 'False
- Height = 330
- Index = 0
- Left = 1020
- TabIndex = 24
- Top = 1605
- Width = 915
- End
- Begin MSAdodcLib.Adodc Adodc1
- Height = 330
- Left = 5505
- Top = 165
- Visible = 0 'False
- Width = 1200
- _ExtentX = 2117
- _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 = 12632256
- ForeColor = -2147483647
- 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 = " 浏览违章记录"
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "宋体"
- Size = 10.5
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- _Version = 393216
- End
- Begin VB.Frame Frame1
- Caption = "车辆违章记录"
- BeginProperty Font
- Name = "宋体"
- Size = 10.5
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H80000001&
- Height = 1410
- Left = 120
- TabIndex = 6
- Top = 105
- Width = 6375
- Begin VB.TextBox Text1
- Enabled = 0 'False
- Height = 300
- Left = 1200
- TabIndex = 11
- Top = 270
- Width = 1815
- End
- Begin VB.TextBox Text3
- Enabled = 0 'False
- Height = 300
- Left = 1200
- TabIndex = 10
- Top = 990
- Width = 1815
- End
- Begin VB.TextBox Text2
- Enabled = 0 'False
- Height = 300
- Left = 1200
- TabIndex = 9
- Top = 645
- Width = 1815
- End
- Begin VB.TextBox Text4
- Enabled = 0 'False
- Height = 660
- Left = 4320
- MultiLine = -1 'True
- ScrollBars = 2 'Vertical
- TabIndex = 8
- Top = 645
- Width = 1830
- End
- Begin MSComCtl2.DTPicker DTPicker1
- Height = 300
- Left = 4320
- TabIndex = 7
- Top = 285
- Width = 1815
- _ExtentX = 3201
- _ExtentY = 529
- _Version = 393216
- Enabled = 0 'False
- Format = 65994753
- CurrentDate = 38054
- End
- Begin VB.Label Label9
- Caption = "*"
- ForeColor = &H000000FF&
- Height = 135
- Left = 1065
- TabIndex = 19
- Top = 645
- Width = 135
- End
- Begin VB.Label Label8
- Caption = "*"
- ForeColor = &H000000FF&
- Height = 135
- Left = 4200
- TabIndex = 18
- Top = 300
- Width = 135
- End
- Begin VB.Label Label7
- Caption = "*"
- ForeColor = &H000000FF&
- Height = 135
- Left = 1080
- TabIndex = 17
- Top = 330
- Width = 135
- End
- Begin VB.Label Label1
- Caption = "车牌号码:"
- Height = 255
- Left = 120
- TabIndex = 16
- Top = 330
- Width = 975
- End
- Begin VB.Label Label2
- Caption = "违章原因:"
- Height = 255
- Left = 120
- TabIndex = 15
- Top = 690
- Width = 975
- End
- Begin VB.Label Label3
- Caption = "处 罚:"
- Height = 255
- Left = 120
- TabIndex = 14
- Top = 1050
- Width = 975
- End
- Begin VB.Label Label4
- Caption = "违章时间:"
- Height = 255
- Left = 3240
- TabIndex = 13
- Top = 330
- Width = 975
- End
- Begin VB.Label Label5
- Caption = "备 注:"
- Height = 255
- Left = 3240
- TabIndex = 12
- Top = 690
- Width = 975
- End
- End
- Begin VB.CommandButton cmdExit
- Caption = "退 出(&E)"
- Height = 330
- Left = 5520
- TabIndex = 5
- Top = 1995
- Width = 915
- End
- Begin VB.CommandButton cmdCancel
- Caption = "取 消(&Q)"
- Enabled = 0 'False
- Height = 330
- Left = 3720
- TabIndex = 4
- Top = 1995
- Width = 915
- End
- Begin VB.CommandButton cmdOk
- Caption = "确 定(&O)"
- Enabled = 0 'False
- Height = 330
- Left = 2820
- TabIndex = 3
- Top = 1995
- Width = 915
- End
- Begin VB.CommandButton cmdFind
- Caption = "查询 (&F)"
- Height = 330
- Left = 120
- TabIndex = 20
- Top = 1605
- Width = 915
- End
- Begin VB.CommandButton cmdDelete
- Caption = "删 除(&D)"
- Height = 330
- Left = 1920
- TabIndex = 2
- Top = 1995
- Width = 915
- End
- Begin VB.CommandButton cmdUpdate
- Caption = "修 改(&U)"
- Height = 330
- Left = 1024
- TabIndex = 1
- Top = 1995
- Width = 915
- End
- Begin VB.CommandButton cmdAdd
- Caption = "添 加(&A)"
- Height = 330
- Left = 120
- TabIndex = 0
- Top = 1995
- Width = 915
- End
- End
- Attribute VB_Name = "frmcarWZlr"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Dim i As Integer
- Private Sub cmdAdd_Click()
- Adodc1.Recordset.AddNew
- Unlockctl
- Text1 = "": Text2 = ""
- Text3 = "": Text4 = ""
- DTPicker1.Value = Format(Now, "yyyy-mm-dd")
- Text1.SetFocus
- cmdOk.Enabled = True: cmdCancel.Enabled = True
- cmdUpdate.Enabled = False: cmdDelete.Enabled = False
- i = 1
- Adodc1.Enabled = False
- End Sub
- Private Sub cmdCancel_Click()
- On Error Resume Next '当没有添加数据的时候 处理异常
- Adodc1.Recordset.CancelUpdate
- Adodc1.Refresh
- Lockctl
- cmdCancel.Enabled = False: cmdOk.Enabled = False
- cmdAdd.Enabled = True: cmdUpdate.Enabled = True
- cmdDelete.Enabled = True: Adodc1.Enabled = True
- End Sub
- Private Sub cmdDelete_Click()
- If MsgBox("您确实要删除记录吗?", vbOKCancel, "系统提示") = vbOK Then
- Adodc1.Recordset.Delete
- MsgBox " 记录已删除!", , "系统提示"
- Adodc1.Refresh
- Text1.Text = ""
- Text2.Text = ""
- Text3.Text = ""
- Text4.Text = ""
- End If
- End Sub
- Private Sub cmdExit_Click()
- On Error Resume Next
- MDIForm1.StatusBar1.Panels(1).Text = ""
- adors.Close
- 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
- On Error Resume Next
- Text1.Text = Adodc1.Recordset.Fields(0)
- Text2.Text = Adodc1.Recordset.Fields(1)
- Text3.Text = Adodc1.Recordset.Fields(2)
- DTPicker1.Value = Adodc1.Recordset.Fields(3)
- Text4.Text = Adodc1.Recordset.Fields(4)
- Command1(0).Enabled = True
- Command1(1).Enabled = True
- Command1(2).Enabled = True
- Command1(3).Enabled = True
- 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
- If Text2 = "" Then
- MsgBox "违章原因不能为空", , "系统提示"
- Text2.SetFocus: Exit Sub
- End If
- If DTPicker1.Value = "" Then
- MsgBox "违章时间不能为空", , "系统提示"
- DTPicker1.SetFocus: Exit Sub
- End If
- Adodc1.Recordset.Fields(0) = Text1.Text
- Adodc1.Recordset.Fields(1) = Text2.Text
- Adodc1.Recordset.Fields(2) = Text3.Text
- Adodc1.Recordset.Fields(3) = DTPicker1.Value
- Adodc1.Recordset.Fields(4) = Text4.Text
- Adodc1.Recordset.Update
- MsgBox "记录添加成功!", , "系统提示"
- Case 2
- On Error Resume Next
- Adodc1.Recordset.Fields(0) = Text1.Text
- Adodc1.Recordset.Fields(1) = Text2.Text
- Adodc1.Recordset.Fields(2) = Text3.Text
- Adodc1.Recordset.Fields(3) = DTPicker1.Value
- Adodc1.Recordset.Fields(4) = Text4.Text
- Adodc1.Recordset.Update
- MsgBox "记录修改成功!", , "系统提示"
- End Select
- Lockctl
- cmdOk.Enabled = False: cmdCancel.Enabled = False
- cmdAdd.Enabled = True: cmdUpdate.Enabled = True
- cmdDelete.Enabled = True: Adodc1.Enabled = True
- Command1(0).Enabled = False: Command1(1).Enabled = False
- Command1(2).Enabled = False: Command1(3).Enabled = False
- End Sub
- Private Sub cmdUpdate_Click()
- Unlockctl
- Text1.Enabled = False: Adodc1.Enabled = False
- cmdOk.Enabled = True: cmdCancel.Enabled = True
- cmdAdd.Enabled = False: cmdDelete.Enabled = False
- i = 2
- 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
- End If
- Case 2
- If Adodc1.Recordset.EOF = False Then
- Adodc1.Recordset.MoveNext
- End If
- Case 3
- Adodc1.Recordset.MoveLast
- End Select
- Text1.Text = Adodc1.Recordset.Fields(0)
- Text2.Text = Adodc1.Recordset.Fields(1)
- Text3.Text = Adodc1.Recordset.Fields(2)
- DTPicker1.Value = Adodc1.Recordset.Fields(3)
- Text4.Text = Adodc1.Recordset.Fields(4)
- End Sub
- Private Sub Form_Load()
- frmcarWZlr.Width = 6720: frmcarWZlr.Height = 2730
- Adodc1.RecordSource = "select * from 车辆违章表"
- Adodc1.Refresh
- If Adodc1.Recordset.RecordCount > 0 Then DTPicker1.Value = Adodc1.Recordset.Fields("违章时间").Value
- End Sub
- Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
- cmdExit_Click
- End Sub
- Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
- If KeyCode = vbKeyReturn Then Text2.SetFocus
- 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 Text2_KeyDown(KeyCode As Integer, Shift As Integer)
- If KeyCode = vbKeyReturn Then Text3.SetFocus
- End Sub
- Private Sub Text3_KeyPress(KeyAscii As Integer)
- If KeyAscii = 13 Then DTPicker1.SetFocus
- End Sub
- Private Sub DTPicker1_KeyPress(KeyAscii As Integer)
- If KeyAscii = 13 Then Text4.SetFocus
- End Sub
- Private Sub Lockctl()
- Text1.Enabled = False: Text2.Enabled = False
- Text3.Enabled = False: Text4.Enabled = False
- DTPicker1.Enabled = False
- End Sub
- Private Sub Unlockctl()
- Text1.Enabled = True: Text2.Enabled = True
- Text3.Enabled = True: Text4.Enabled = True
- DTPicker1.Enabled = True
- End Sub