frmcarDAlr.frm
资源名称:0123..rar [点击查看]
上传用户:naidiweb
上传日期:2013-08-15
资源大小:672k
文件大小:25k
源码类别:
软件设计/软件工程
开发平台:
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 frmcarDAlr
- BackColor = &H8000000A&
- BorderStyle = 3 'Fixed Dialog
- Caption = "车辆档案记录"
- ClientHeight = 2700
- ClientLeft = 45
- ClientTop = 330
- ClientWidth = 7320
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MDIChild = -1 'True
- MinButton = 0 'False
- ScaleHeight = 2700
- ScaleWidth = 7320
- ShowInTaskbar = 0 'False
- Begin VB.ComboBox Combo2
- DataField = "驾驶员编号"
- DataSource = "Adodc1"
- Enabled = 0 'False
- Height = 300
- Left = 1440
- TabIndex = 34
- Top = 1080
- Width = 1365
- End
- Begin VB.CommandButton cmdCancel
- Caption = "取 消(&Q)"
- Enabled = 0 'False
- Height = 330
- Left = 6030
- TabIndex = 1
- Top = 1875
- Width = 1095
- End
- Begin VB.CommandButton cmdok
- Caption = "确 定(&O)"
- Enabled = 0 'False
- Height = 330
- Left = 6030
- TabIndex = 4
- Top = 1560
- Width = 1095
- End
- Begin VB.CommandButton cmdFind
- Caption = "查 询(&F)"
- Height = 330
- Left = 6030
- TabIndex = 33
- Top = 1170
- Width = 1095
- End
- Begin VB.Frame Frame1
- Caption = "车辆档案记录"
- BeginProperty Font
- Name = "宋体"
- Size = 10.5
- Charset = 134
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00FF0000&
- Height = 2505
- Left = 120
- TabIndex = 6
- Top = 105
- Width = 5685
- Begin VB.ComboBox Combo1
- DataField = "车辆类型"
- DataSource = "Adodc1"
- Enabled = 0 'False
- Height = 300
- Left = 1320
- TabIndex = 32
- Top = 615
- Width = 1365
- End
- Begin VB.ComboBox cmnj
- DataField = "年检审"
- DataSource = "Adodc1"
- Enabled = 0 'False
- Height = 300
- ItemData = "frmcarDAlr.frx":0000
- Left = 4200
- List = "frmcarDAlr.frx":000A
- Style = 2 'Dropdown List
- TabIndex = 15
- Top = 969
- Width = 1365
- End
- Begin VB.ComboBox cmbf
- DataField = "报废否"
- DataSource = "Adodc1"
- Enabled = 0 'False
- Height = 300
- ItemData = "frmcarDAlr.frx":0016
- Left = 4200
- List = "frmcarDAlr.frx":0020
- Style = 2 'Dropdown List
- TabIndex = 14
- Top = 1965
- Width = 1365
- End
- Begin VB.ComboBox cmyd
- DataField = "异动否"
- DataSource = "Adodc1"
- Enabled = 0 'False
- Height = 300
- ItemData = "frmcarDAlr.frx":002C
- Left = 4200
- List = "frmcarDAlr.frx":0036
- Style = 2 'Dropdown List
- TabIndex = 13
- Top = 1653
- Width = 1365
- End
- Begin VB.ComboBox cmbx
- DataField = "保险否"
- DataSource = "Adodc1"
- Enabled = 0 'False
- Height = 300
- ItemData = "frmcarDAlr.frx":0042
- Left = 4200
- List = "frmcarDAlr.frx":004C
- Style = 2 'Dropdown List
- TabIndex = 12
- Top = 1311
- Width = 1365
- End
- Begin VB.TextBox Text4
- DataField = "使用人或单位"
- DataSource = "Adodc1"
- Enabled = 0 'False
- Height = 285
- Left = 1320
- TabIndex = 11
- Top = 1311
- Width = 1365
- End
- Begin VB.TextBox Text5
- DataField = "车辆所在单位"
- DataSource = "Adodc1"
- Enabled = 0 'False
- Height = 285
- Left = 1320
- TabIndex = 10
- Top = 1653
- Width = 1365
- End
- Begin VB.TextBox Text6
- DataField = "备注"
- DataSource = "Adodc1"
- Enabled = 0 'False
- Height = 285
- Left = 1320
- TabIndex = 9
- Top = 1995
- Width = 1365
- End
- Begin VB.TextBox Text1
- DataField = "车牌号码"
- DataSource = "Adodc1"
- Enabled = 0 'False
- Height = 285
- Left = 1320
- TabIndex = 8
- Top = 285
- Width = 1365
- End
- Begin VB.TextBox Text7
- DataField = "厂牌型号"
- DataSource = "Adodc1"
- Enabled = 0 'False
- Height = 285
- Left = 4200
- TabIndex = 7
- Top = 285
- Width = 1365
- End
- Begin MSComCtl2.DTPicker DTPicker1
- Height = 285
- Left = 4200
- TabIndex = 16
- Top = 615
- Width = 1365
- _ExtentX = 2408
- _ExtentY = 503
- _Version = 393216
- Enabled = 0 'False
- Format = 27000833
- CurrentDate = 38052
- End
- Begin MSAdodcLib.Adodc Adodc1
- Height = 330
- Left = 1995
- Top = 2130
- Visible = 0 'False
- Width = 1455
- _ExtentX = 2566
- _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 = 16711680
- 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 = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- _Version = 393216
- End
- Begin MSAdodcLib.Adodc Adodc3
- Height = 330
- Left = 2430
- Top = 2160
- 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.Label Label5
- Caption = "*"
- ForeColor = &H000000FF&
- Height = 135
- Index = 2
- Left = 4020
- TabIndex = 31
- Top = 675
- Width = 255
- End
- Begin VB.Label Label5
- Caption = "*"
- ForeColor = &H000000FF&
- Height = 135
- Index = 1
- Left = 1065
- TabIndex = 30
- Top = 630
- Width = 255
- End
- Begin VB.Label Label5
- Caption = "*"
- ForeColor = &H000000FF&
- Height = 135
- Index = 0
- Left = 1080
- TabIndex = 29
- Top = 345
- Width = 255
- End
- Begin VB.Label Label2
- Caption = "车辆类型:"
- Height = 255
- Left = 105
- TabIndex = 28
- Top = 627
- Width = 975
- End
- Begin VB.Label Label3
- Caption = "驾驶员编号:"
- Height = 255
- Left = 120
- TabIndex = 27
- Top = 969
- Width = 1095
- End
- Begin VB.Label Label4
- Caption = "购置日期:"
- Height = 255
- Left = 3120
- TabIndex = 26
- Top = 627
- Width = 975
- End
- Begin VB.Label Label10
- Caption = "使用人或单位"
- Height = 255
- Left = 105
- TabIndex = 25
- Top = 1311
- Width = 1335
- End
- Begin VB.Label Label11
- Caption = "车辆所在单位"
- Height = 255
- Left = 120
- TabIndex = 24
- Top = 1653
- Width = 1335
- End
- Begin VB.Label Label12
- Caption = "年 检 否:"
- Height = 255
- Left = 3120
- TabIndex = 23
- Top = 969
- Width = 975
- End
- Begin VB.Label Label13
- Caption = "保 险 否:"
- Height = 255
- Left = 3120
- TabIndex = 22
- Top = 1311
- Width = 975
- End
- Begin VB.Label Label14
- Caption = "异 动 否:"
- Height = 255
- Left = 3120
- TabIndex = 21
- Top = 1653
- Width = 975
- End
- Begin VB.Label Label15
- Caption = "报 废 否:"
- Height = 255
- Left = 3120
- TabIndex = 20
- Top = 1995
- Width = 975
- End
- Begin VB.Label Label16
- Caption = "备 注:"
- Height = 255
- Left = 120
- TabIndex = 19
- Top = 1995
- Width = 975
- End
- Begin VB.Label Label1
- Caption = "车牌号码:"
- Height = 255
- Left = 120
- TabIndex = 18
- Top = 285
- Width = 975
- End
- Begin VB.Label Label7
- Caption = "厂牌型号:"
- Height = 255
- Left = 3120
- TabIndex = 17
- Top = 285
- Width = 975
- End
- End
- Begin VB.CommandButton cmdExit
- Caption = " 退 出(&E)"
- Height = 330
- Left = 6030
- TabIndex = 5
- Top = 2265
- Width = 1095
- End
- Begin VB.CommandButton cmdDelete
- Caption = "删 除(&D)"
- Height = 330
- Left = 6030
- TabIndex = 3
- Top = 795
- Width = 1095
- End
- Begin VB.CommandButton cmdUpdate
- Caption = "修 改(&U)"
- Height = 330
- Left = 6030
- TabIndex = 2
- Top = 480
- Width = 1095
- End
- Begin VB.CommandButton cmdAdd
- Caption = "添 加(&A)"
- Height = 330
- Left = 6030
- TabIndex = 0
- Top = 165
- Width = 1095
- End
- Begin MSAdodcLib.Adodc Adodc2
- Height = 330
- Left = 1680
- Top = 2190
- Visible = 0 'False
- Width = 1830
- _ExtentX = 3228
- _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
- End
- Attribute VB_Name = "frmcardalr"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Dim i As Integer
- Private Sub cmbf_KeyPress(KeyAscii As Integer)
- KeyAscii = valiText(KeyAscii, Chr(13), True)
- 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
- End Sub
- Private Sub cmdDelete_Click()
- If MsgBox("您确实要删除记录吗?", vbOKCancel, "系统提示") = vbOK Then
- adoCon.Execute ("delete from 车辆档案 where 车牌号码='" & Text1 & "'")
- 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
- On Error Resume Next
- Text1.Text = Adodc1.Recordset.Fields(0)
- Combo1.Text = Adodc1.Recordset.Fields(1)
- Combo2.Text = Adodc1.Recordset.Fields(2)
- DTPicker1.Value = Adodc1.Recordset.Fields(3)
- Text7.Text = Adodc1.Recordset.Fields(4)
- Text4.Text = Adodc1.Recordset.Fields(5)
- Text5.Text = Adodc1.Recordset.Fields(6)
- cmnj.Text = Adodc1.Recordset.Fields(7)
- cmbx.Text = Adodc1.Recordset.Fields(8)
- cmyd.Text = Adodc1.Recordset.Fields(9)
- cmbf.Text = Adodc1.Recordset.Fields(10)
- Text6.Text = Adodc1.Recordset.Fields(11)
- 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 Combo1.Text = "" Then
- MsgBox "车辆类型不能为空", , "系统提示"
- Combo1.SetFocus
- Exit Sub
- End If
- If DTPicker1.Value = "" Then
- MsgBox "购置日期不能为空", , "系统提示"
- DTPicker1.SetFocus
- Exit Sub
- End If
- adoCon.Execute ("insert into 车辆档案 values ('" & Text1 & "','" & Combo1 & "','" & Combo2 & "','" & DTPicker1.Value & "','" & Text7 & "','" & Text4 & "','" & Text5 & "','" & cmnj & "','" & cmbx & "','" & cmyd & "','" & cmbf & "','" & Text6 & "')")
- MsgBox "记录添加成功!", , "系统提示"
- Adodc1.Refresh
- Case 2
- adoCon.Execute ("update 车辆档案 set 车辆类型='" & Combo1 & "',驾驶员编号='" & Combo2 & "',使用人或单位='" & Text4 & "',车辆所在单位='" & Text5 & "',备注='" & Text6 & "', 厂牌型号='" & Text7 & "',购置日期='" & DTPicker1.Value & "',年检审='" & cmnj.Text & "',保险否='" & cmbx.Text & "',异动否='" & cmyd.Text & "',报废否='" & cmbf.Text & "' where 车牌号码='" & Text1 & "'")
- MsgBox "记录修改成功!", , "系统提示"
- Adodc1.Refresh
- End Select
- Lockctl
- cmdok.Enabled = False: cmdCancel.Enabled = False
- cmdAdd.Enabled = True: cmdUpdate.Enabled = True
- cmdDelete.Enabled = True: Adodc1.Enabled = True
- End Sub
- Private Sub cmdAdd_Click()
- Unlockctl
- DTPicker1.Value = Format(Now, "yyyy-mm-dd")
- Text1 = "": Text2 = "": Combo2 = "": Text4 = "": Text5 = "": Text6 = "": Text7 = ""
- Combo1.Text = ""
- cmnj.Text = "是"
- cmbx.Text = "是"
- cmyd.Text = "是"
- cmbf.Text = "是"
- Text1.SetFocus
- cmdok.Enabled = True: cmdCancel.Enabled = True
- cmdDelete.Enabled = False: Combo1.Visible = True
- Adodc1.Enabled = False: cmdUpdate.Enabled = False
- i = 1
- 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
- End Sub
- Private Sub cmnj_KeyPress(KeyAscii As Integer)
- KeyAscii = valiText(KeyAscii, Chr(13), True)
- If KeyAscii = 13 Then cmbx.SetFocus
- End Sub
- Private Sub cmbx_KeyPress(KeyAscii As Integer)
- KeyAscii = valiText(KeyAscii, Chr(13), True)
- If KeyAscii = 13 Then cmyd.SetFocus
- End Sub
- Private Sub cmyd_KeyPress(KeyAscii As Integer)
- KeyAscii = valiText(KeyAscii, Chr(13), True)
- If KeyAscii = 13 Then cmbf.SetFocus
- End Sub
- Private Sub DTPicker1_KeyDown(KeyCode As Integer, Shift As Integer)
- If KeyAscii = vbKeyReturn Then cmnj.SetFocus
- End Sub
- Private Sub Form_Load()
- frmcardalr.Height = 3075: frmcardalr.Width = 7410
- Adodc1.RecordSource = "select * from 车辆档案"
- Adodc1.Refresh
- If Adodc1.Recordset.RecordCount > 0 Then DTPicker1.Value = Adodc1.Recordset.Fields("购置日期")
- Adodc2.RecordSource = "select * from 车辆类型表"
- Adodc2.Refresh
- If Adodc2.Recordset.RecordCount = 0 Then Exit Sub
- For i = 0 To Adodc2.Recordset.RecordCount - 1
- Combo1.AddItem Adodc2.Recordset.Fields(0).Value
- Adodc2.Recordset.MoveNext
- Next
- Adodc3.RecordSource = "select * from 驾驶员档案"
- Adodc3.Refresh
- If Adodc3.Recordset.RecordCount = 0 Then Exit Sub
- For i = 0 To Adodc3.Recordset.RecordCount - 1
- Combo2.AddItem Adodc3.Recordset.Fields(0).Value
- Adodc3.Recordset.MoveNext
- Next
- On Error Resume Next
- Combo1.Text = Adodc1.Recordset.Fields(1)
- Combo2.Text = Adodc1.Recordset.Fields(2)
- 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 = 13 Then Combo1.SetFocus
- End Sub
- Private Sub Text1_LostFocus()
- Dim rs As New ADODB.Recordset
- Set rs = adoCon.Execute("select * from 车辆档案 where 车牌号码='" & Text1.Text & "'")
- If rs.EOF = False Then
- MsgBox "此车牌号码已经存在!", , "系统提示"
- Text1 = ""
- Text1.SetFocus
- End If
- rs.Close
- End Sub
- Private Sub Combo1_KeyPress(KeyAscii As Integer)
- KeyAscii = valiText(KeyAscii, Chr(13), True)
- If KeyAscii = 13 Then Combo2.SetFocus
- End Sub
- Private Sub Combo2_KeyPress(KeyAscii As Integer)
- KeyAscii = valiText(KeyAscii, Chr(13), True)
- If KeyAscii = 13 Then Text4.SetFocus
- End Sub
- 'Private Sub Text3_LostFocus()
- ' Adodc1.RecordSource = "select * from 驾驶员档案 where 驾驶员编号='" + Text3.Text + "'"
- ' Adodc1.Refresh
- ' If Text3.Text = "" Then Exit Sub
- ' If Adodc1.Recordset.RecordCount > 0 Then
- ' Else
- ' MsgBox "本公司没有驾驶员!", , "系统提示"
- ' Text3.SetFocus
- ' End If
- 'End Sub
- Private Sub Text5_KeyPress(KeyAscii As Integer)
- If KeyAscii = 13 Then Text6.SetFocus
- End Sub
- Private Sub Text6_KeyPress(KeyAscii As Integer)
- If KeyAscii = 13 Then Text7.SetFocus
- End Sub
- Private Sub Text4_KeyPress(KeyAscii As Integer)
- If KeyAscii = 13 Then Text5.SetFocus
- End Sub
- Private Sub Text7_KeyPress(KeyAscii As Integer)
- If KeyAscii = 13 Then DTPicker1.SetFocus
- End Sub
- Private Sub Lockctl()
- Text1.Enabled = False: Combo1.Enabled = False: Combo2.Enabled = False
- Text4.Enabled = False: Text5.Enabled = False: Text6.Enabled = False
- Text7.Enabled = False
- DTPicker1.Enabled = False
- cmnj.Enabled = False: cmbx.Enabled = False: cmyd.Enabled = False: cmbf.Enabled = False
- End Sub
- Private Sub Unlockctl()
- Text1.Enabled = True: Combo1.Enabled = True: Combo2.Enabled = True
- Text4.Enabled = True: Text5.Enabled = True: Text6.Enabled = True
- Text7.Enabled = True
- DTPicker1.Enabled = True
- cmnj.Enabled = True: cmbx.Enabled = True: cmyd.Enabled = True: cmbf.Enabled = True
- End Sub