frmDriverlr.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 frmDriverlr
- BorderStyle = 1 'Fixed Single
- Caption = "驾驶员列表"
- ClientHeight = 2595
- ClientLeft = 45
- ClientTop = 330
- ClientWidth = 8340
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MDIChild = -1 'True
- MinButton = 0 'False
- ScaleHeight = 2595
- ScaleWidth = 8340
- Begin VB.CommandButton cmdFind
- Caption = "查 询(&F)"
- Height = 330
- Left = 3300
- TabIndex = 40
- Top = 2250
- Width = 975
- End
- Begin MSAdodcLib.Adodc Adodc1
- Height = 330
- Left = 5535
- Top = 1680
- Visible = 0 'False
- Width = 2010
- _ExtentX = 3545
- _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.Frame Frame1
- Height = 2130
- Left = 75
- TabIndex = 6
- Top = 90
- Width = 8145
- Begin VB.TextBox Text1
- DataField = "驾驶员编号"
- Enabled = 0 'False
- Height = 270
- Left = 1380
- TabIndex = 17
- Top = 210
- Width = 1335
- End
- Begin VB.TextBox Text2
- DataField = "姓名"
- Enabled = 0 'False
- Height = 270
- Left = 1380
- MaxLength = 5
- TabIndex = 16
- Top = 577
- Width = 1335
- End
- Begin VB.TextBox Text3
- DataField = "性别"
- Enabled = 0 'False
- Height = 270
- Left = 1380
- MaxLength = 2
- TabIndex = 15
- Top = 944
- Width = 1335
- End
- Begin VB.TextBox Text4
- DataField = "驾驶证号"
- Enabled = 0 'False
- Height = 270
- Left = 1380
- MaxLength = 18
- TabIndex = 13
- Top = 1680
- Width = 1335
- End
- Begin VB.TextBox Text5
- DataField = "证件有效期"
- Enabled = 0 'False
- Height = 270
- Left = 4185
- MaxLength = 18
- TabIndex = 12
- Top = 570
- Width = 1335
- End
- Begin VB.TextBox Text6
- DataField = "驾龄"
- Enabled = 0 'False
- Height = 270
- Left = 4185
- TabIndex = 11
- Top = 930
- Width = 1335
- End
- Begin VB.ComboBox Combo1
- DataField = "准驾车型"
- Enabled = 0 'False
- Height = 300
- Left = 4185
- TabIndex = 10
- Top = 1290
- Width = 1335
- End
- Begin VB.TextBox Text7
- DataField = "联系电话"
- Enabled = 0 'False
- Height = 270
- Left = 6645
- MaxLength = 15
- TabIndex = 9
- Top = 210
- Width = 1335
- End
- Begin VB.TextBox Text8
- DataField = "年检记录"
- Enabled = 0 'False
- Height = 660
- Left = 6645
- MultiLine = -1 'True
- ScrollBars = 2 'Vertical
- TabIndex = 8
- Top = 570
- Width = 1335
- End
- Begin VB.TextBox Text9
- DataField = "备注"
- Enabled = 0 'False
- Height = 630
- Left = 6645
- MultiLine = -1 'True
- ScrollBars = 2 'Vertical
- TabIndex = 7
- Top = 1320
- Width = 1335
- End
- Begin MSComCtl2.DTPicker DTPicker1
- DataField = "出生年月"
- Height = 270
- Left = 1395
- TabIndex = 14
- Top = 1305
- Width = 1335
- _ExtentX = 2355
- _ExtentY = 476
- _Version = 393216
- Enabled = 0 'False
- Format = 65994753
- CurrentDate = 38323
- End
- Begin MSComCtl2.DTPicker DTPicker2
- DataField = "领证日期"
- Height = 270
- Left = 4185
- TabIndex = 18
- Top = 210
- Width = 1335
- _ExtentX = 2355
- _ExtentY = 476
- _Version = 393216
- Enabled = 0 'False
- Format = 65994753
- CurrentDate = 38323
- End
- Begin MSComCtl2.DTPicker DTPicker3
- DataField = "何时参加工作"
- Height = 270
- Left = 4185
- TabIndex = 19
- Top = 1680
- Width = 1335
- _ExtentX = 2355
- _ExtentY = 476
- _Version = 393216
- Enabled = 0 'False
- Format = 65994753
- CurrentDate = 38323
- End
- Begin MSAdodcLib.Adodc Adodc2
- Height = 330
- Left = 5550
- Top = 960
- 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 = -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 Label5
- Caption = "*"
- ForeColor = &H000000FF&
- Height = 135
- Index = 7
- Left = 4065
- TabIndex = 39
- Top = 255
- Width = 255
- End
- Begin VB.Label Label5
- Caption = "*"
- ForeColor = &H000000FF&
- Height = 135
- Index = 6
- Left = 4065
- TabIndex = 38
- Top = 600
- Width = 255
- End
- Begin VB.Label Label5
- Caption = "*"
- ForeColor = &H000000FF&
- Height = 135
- Index = 5
- Left = 1275
- TabIndex = 37
- Top = 1710
- Width = 255
- End
- Begin VB.Label Label5
- Caption = "*"
- ForeColor = &H000000FF&
- Height = 135
- Index = 4
- Left = 1275
- TabIndex = 36
- Top = 255
- Width = 255
- End
- Begin VB.Label Label5
- Caption = "*"
- ForeColor = &H000000FF&
- Height = 135
- Index = 3
- Left = 1275
- TabIndex = 35
- Top = 600
- Width = 255
- End
- Begin VB.Label Label5
- Caption = "*"
- ForeColor = &H000000FF&
- Height = 135
- Index = 1
- Left = 1275
- TabIndex = 34
- Top = 990
- Width = 255
- End
- Begin VB.Label Label5
- Caption = "*"
- ForeColor = &H000000FF&
- Height = 135
- Index = 2
- Left = 1275
- TabIndex = 33
- Top = 1335
- Width = 255
- End
- Begin VB.Label Label1
- Caption = "驾驶员编号:"
- Height = 300
- Left = 255
- TabIndex = 32
- Top = 285
- Width = 1260
- End
- Begin VB.Label Label2
- Caption = "姓名:"
- Height = 300
- Left = 255
- TabIndex = 31
- Top = 633
- Width = 1260
- End
- Begin VB.Label Label3
- Caption = "性别:"
- Height = 300
- Left = 255
- TabIndex = 30
- Top = 981
- Width = 1260
- End
- Begin VB.Label Label4
- Caption = "出生年月:"
- Height = 300
- Left = 255
- TabIndex = 29
- Top = 1329
- Width = 1260
- End
- Begin VB.Label Label5
- Caption = "驾驶证号:"
- Height = 300
- Index = 0
- Left = 255
- TabIndex = 28
- Top = 1680
- Width = 1260
- End
- Begin VB.Label Label6
- Caption = "领证日期:"
- Height = 300
- Left = 2850
- TabIndex = 27
- Top = 285
- Width = 1260
- End
- Begin VB.Label Label7
- Caption = "证件有效期:"
- Height = 300
- Left = 2850
- TabIndex = 26
- Top = 630
- Width = 1260
- End
- Begin VB.Label Label8
- Caption = "驾龄:"
- Height = 300
- Left = 2850
- TabIndex = 25
- Top = 975
- Width = 1260
- End
- Begin VB.Label Label9
- Caption = "准驾车型:"
- Height = 300
- Left = 2850
- TabIndex = 24
- Top = 1335
- Width = 1260
- End
- Begin VB.Label Label10
- Caption = "何时参加工作:"
- Height = 300
- Left = 2850
- TabIndex = 23
- Top = 1680
- Width = 1260
- End
- Begin VB.Label Label11
- Caption = "联系电话:"
- Height = 300
- Left = 5640
- TabIndex = 22
- Top = 285
- Width = 1260
- End
- Begin VB.Label Label12
- Caption = "年检记录:"
- Height = 300
- Left = 5640
- TabIndex = 21
- Top = 630
- Width = 1260
- End
- Begin VB.Label Label13
- Caption = "备注:"
- Height = 300
- Left = 5640
- TabIndex = 20
- Top = 1335
- Width = 1260
- End
- End
- Begin VB.CommandButton cmdExit
- Caption = "退 出(&E)"
- Height = 330
- Left = 7245
- TabIndex = 0
- Top = 2250
- Width = 975
- End
- Begin VB.CommandButton cmdDelete
- Caption = "删 除(&D)"
- Height = 330
- Left = 1995
- TabIndex = 3
- Top = 2250
- Width = 975
- End
- Begin VB.CommandButton cmdCancel
- Caption = "取 消(&Q)"
- Enabled = 0 'False
- Height = 330
- Left = 5235
- TabIndex = 1
- Top = 2250
- Width = 975
- End
- Begin VB.CommandButton cmdUpdate
- Caption = "修 改(&U)"
- Height = 330
- Left = 1035
- TabIndex = 4
- Top = 2250
- Width = 975
- End
- Begin VB.CommandButton cmdAdd
- Caption = "添 加(&A)"
- Height = 330
- Left = 75
- TabIndex = 5
- Top = 2250
- Width = 975
- End
- Begin VB.CommandButton cmdOk
- Caption = "确 定(&O)"
- Enabled = 0 'False
- Height = 330
- Left = 4275
- TabIndex = 2
- Top = 2250
- Width = 975
- End
- End
- Attribute VB_Name = "frmDriverlr"
- 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
- Dim temp1
- temp1 = CStr(Year(Now))
- Adodc1.RecordSource = "select * from 驾驶员档案 order by 驾驶员编号"
- Adodc1.Refresh
- If Adodc1.Recordset.RecordCount > 0 Then
- Adodc1.Recordset.MoveLast
- Text1.Text = Year(Now) & Format(Val(Right(Adodc1.Recordset.Fields(0), 4) + 1), "0000")
- Else
- Text1.Text = Year(Now) & "0001"
- End If
- Text2.Text = ""
- Text3.Text = ""
- Text4.Text = ""
- Text5.Text = ""
- Text6.Text = ""
- Text7.Text = ""
- Text8.Text = ""
- Text9.Text = ""
- Combo1.Text = ""
- Text2.SetFocus
- cmdOk.Enabled = True
- cmdCancel.Enabled = True
- cmdUpdate.Enabled = False
- cmdDelete.Enabled = False
- DTPicker1.Visible = True
- Adodc1.Enabled = False
- i = 1
- End Sub
- Private Sub cmdCancel_Click()
- On Error Resume Next '当没有添加数据的时候 处理异常
- Adodc1.Recordset.CancelUpdate
- Adodc1.Refresh
- Lockctl
- Text1.Text = ""
- cmdOk.Enabled = False
- cmdCancel.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
- adoCon.Execute ("delete from 驾驶员档案 where 驾驶员编号='" & Text1 & "'")
- MsgBox " 记录已删除!", , "系统提示"
- Adodc1.Refresh
- Text1.Text = ""
- Text2.Text = ""
- Text3.Text = ""
- Text4.Text = ""
- Text5.Text = ""
- Text6.Text = ""
- Text7.Text = ""
- Text8.Text = ""
- Text9.Text = ""
- Combo1.Text = ""
- End If
- End Sub
- Private Sub cmdExit_Click()
- 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)
- Text2.Text = Adodc1.Recordset.Fields(1)
- Text3.Text = Adodc1.Recordset.Fields(2)
- DTPicker1.Value = Adodc1.Recordset.Fields(3)
- Text4.Text = Adodc1.Recordset.Fields(4)
- DTPicker2.Value = Adodc1.Recordset.Fields(5)
- Text5.Text = Adodc1.Recordset.Fields(6)
- Text6.Text = Adodc1.Recordset.Fields(7)
- Combo1.Text = Adodc1.Recordset.Fields(8)
- DTPicker3.Value = Adodc1.Recordset.Fields(9)
- Text7.Text = Adodc1.Recordset.Fields(10)
- Text8.Text = Adodc1.Recordset.Fields(11)
- Text9.Text = Adodc1.Recordset.Fields(12)
- 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.Text = "" Or Text2.Text = "" Or Text3.Text = "" Or Text4.Text = "" Or Text5.Text = "" Or Text6.Text = "" Or Text7.Text = "" Or Text8.Text = "" Or Text9.Text = "" Or Combo1.Text = "" Then
- MsgBox "每一项不能为空!", , "系统提示"
- Exit Sub
- End If
- adoCon.Execute ("insert into 驾驶员档案 values ('" & Text1 & "','" & Text2 & "','" & Text3 & "','" & DTPicker1.Value & "','" & Text4 & "','" & DTPicker2.Value & "','" & Text5 & "','" & Text6.Text & "','" & Combo1.Text & "','" & DTPicker3.Value & "','" & Text7.Text & "','" & Text8.Text & "','" & Text9.Text & "')")
- MsgBox "记录添加成功!", , "系统提示"
- Adodc1.Refresh
- Case 2
- adoCon.Execute ("update 驾驶员档案 set 驾驶员编号='" & Text1.Text & "',姓名='" & Text2.Text & "',性别='" & Text3.Text & "',出生年月='" & DTPicker1.Value & "',驾驶证号='" & Text4.Text & "',领证日期='" & DTPicker1.Value & "',证件有效期='" & Text5.Text & "',驾龄='" & Text6.Text & "',准驾车型='" & Combo1.Text & "',何时参加工作='" & DTPicker1.Value & "',联系电话='" & Text7.Text & "',年检记录='" & Text8.Text & "',备注='" & Text9.Text & "' where 驾驶员编号='" & Text1.Text & "'")
- MsgBox "记录修改成功!", , "系统提示"
- Adodc1.Refresh
- End Select
- Lockctl
- cmdOk.Enabled = False
- cmdCancel.Enabled = False
- cmdAdd.Visible = True
- cmdUpdate.Visible = True
- cmdDelete.Visible = True
- Adodc1.Enabled = True
- End Sub
- Private Sub cmdUpdate_Click()
- Unlockctl
- i = 2
- cmdOk.Enabled = True
- cmdCancel.Enabled = True
- cmdAdd.Enabled = False
- cmdDelete.Enabled = False
- DTPicker1.Visible = True
- Adodc1.Enabled = False
- End Sub
- Private Sub Combo1_KeyPress(KeyAscii As Integer)
- KeyAscii = valiText(KeyAscii, Chr(13), True)
- If KeyAscii = 13 Then DTPicker3.SetFocus
- End Sub
- Private Sub DTPicker1_KeyDown(KeyCode As Integer, Shift As Integer)
- If KeyCode = vbKeyReturn Then Text4.SetFocus
- End Sub
- Private Sub DTPicker2_KeyDown(KeyCode As Integer, Shift As Integer)
- If KeyCode = vbKeyReturn Then Text5.SetFocus
- End Sub
- Private Sub DTPicker3_KeyDown(KeyCode As Integer, Shift As Integer)
- If KeyCode = vbKeyReturn Then Text7.SetFocus
- End Sub
- Private Sub Form_Load()
- frmDriverlr.Width = 8460
- frmDriverlr.Height = 3120
- Adodc2.RecordSource = "select * from 车辆类型表"
- Adodc2.Refresh
- For i = 0 To Adodc2.Recordset.RecordCount - 1
- Combo1.AddItem Adodc2.Recordset.Fields(0).Value
- Adodc2.Recordset.MoveNext
- Next
- End Sub
- Private Sub Lockctl()
- Text1.Enabled = False
- Text2.Enabled = False
- Text3.Enabled = False
- Text4.Enabled = False
- Text5.Enabled = False
- Text6.Enabled = False
- Text7.Enabled = False
- DTPicker1.Enabled = False
- DTPicker2.Enabled = False
- DTPicker3.Enabled = False
- Text9.Enabled = False
- Text8.Enabled = False
- Combo1.Enabled = False
- End Sub
- Private Sub Unlockctl()
- Text2.Enabled = True
- Text3.Enabled = True
- Text4.Enabled = True
- Text5.Enabled = True
- Text6.Enabled = True
- Text7.Enabled = True
- DTPicker1.Enabled = True
- DTPicker2.Enabled = True
- DTPicker3.Enabled = True
- Text9.Enabled = True
- Text8.Enabled = True
- Combo1.Enabled = True
- End Sub
- Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
- If KeyCode = vbKeyReturn Then
- If Text1.Text = "" Then
- MsgBox "驾驶编号不能为空!", , "系统提示"
- Text1.SetFocus
- End If
- Text2.SetFocus
- End If
- End Sub
- Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
- If KeyCode = vbKeyReturn Then
- If Text2.Text = "" Then
- MsgBox "姓名不能为空!!", , "系统提示"
- Text2.SetFocus
- End If
- Text3.SetFocus
- End If
- End Sub
- Private Sub Text3_KeyDown(KeyCode As Integer, Shift As Integer)
- If KeyCode = vbKeyReturn Then
- If Text3.Text = "" Then
- MsgBox "性别不能为空!", , "系统提示"
- Text3.SetFocus
- End If
- DTPicker1.SetFocus
- End If
- End Sub
- Private Sub Text4_KeyDown(KeyCode As Integer, Shift As Integer)
- If KeyCode = vbKeyReturn Then
- If Text4.Text = "" Then
- MsgBox "驾驶证号不能为空!!", , "系统提示"
- Text4.SetFocus
- End If
- DTPicker2.SetFocus
- End If
- End Sub
- Private Sub Text5_KeyDown(KeyCode As Integer, Shift As Integer)
- If KeyCode = vbKeyReturn Then
- If Text5.Text = "" Then
- MsgBox "证件有效期不能为空!", , "系统提示"
- Text5.SetFocus
- End If
- Text6.SetFocus
- End If
- End Sub
- Private Sub Text6_KeyDown(KeyCode As Integer, Shift As Integer)
- If KeyCode = vbKeyReturn Then Combo1.SetFocus
- End Sub
- Private Sub Text7_KeyDown(KeyCode As Integer, Shift As Integer)
- If KeyCode = vbKeyReturn Then Text8.SetFocus
- End Sub
- Private Sub Text8_KeyDown(KeyCode As Integer, Shift As Integer)
- If KeyCode = vbKeyReturn Then Text9.SetFocus
- End Sub
- Private Sub Text9_KeyDown(KeyCode As Integer, Shift As Integer)
- If KeyCode = vbKeyReturn Then cmdOk.SetFocus
- End Sub