?? frmcarydlr.frm
字號:
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 frmcarydlr
Caption = "車輛異動列表"
ClientHeight = 2010
ClientLeft = 60
ClientTop = 345
ClientWidth = 6435
LinkTopic = "Form1"
MDIChild = -1 'True
ScaleHeight = 2010
ScaleWidth = 6435
Begin VB.CommandButton cmdExit
Caption = "退 出(&E)"
Height = 330
Left = 5430
TabIndex = 11
Top = 1590
Width = 915
End
Begin VB.CommandButton cmdCancel
Caption = "取 消(&Q)"
Enabled = 0 'False
Height = 330
Left = 4530
TabIndex = 14
Top = 1590
Width = 915
End
Begin VB.CommandButton cmdok
Caption = "確 定(&O)"
Enabled = 0 'False
Height = 330
Left = 3630
TabIndex = 16
Top = 1590
Width = 915
End
Begin VB.CommandButton cmdFind
Caption = "查詢 (&F)"
Height = 330
Left = 2730
TabIndex = 20
Top = 1590
Width = 915
End
Begin VB.CommandButton cmdDelete
Caption = "刪 除(&D)"
Height = 330
Left = 1830
TabIndex = 12
Top = 1590
Width = 915
End
Begin VB.CommandButton cmdUpdate
Caption = "修 改(&U)"
Height = 330
Left = 930
TabIndex = 13
Top = 1590
Width = 915
End
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 3660
Top = 1020
Visible = 0 'False
Width = 1335
_ExtentX = 2355
_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 = -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 = " 瀏覽異動信息記錄"
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 = 30
TabIndex = 15
Top = 1590
Width = 915
End
Begin VB.Frame Frame1
Caption = "異動信息記錄"
Height = 1380
Left = 45
TabIndex = 0
Top = 75
Width = 6330
Begin VB.TextBox Text4
Enabled = 0 'False
Height = 300
Left = 4425
ScrollBars = 2 'Vertical
TabIndex = 10
Top = 607
Width = 1740
End
Begin VB.TextBox Text3
Enabled = 0 'False
Height = 270
Left = 4425
TabIndex = 9
Top = 240
Width = 1740
End
Begin VB.TextBox Text2
Enabled = 0 'False
Height = 270
Left = 1470
TabIndex = 8
Top = 975
Width = 1740
End
Begin MSComCtl2.DTPicker DTPicker1
Height = 270
Left = 1470
TabIndex = 7
Top = 607
Width = 1740
_ExtentX = 3069
_ExtentY = 476
_Version = 393216
Enabled = 0 'False
Format = 66060289
CurrentDate = 38323
End
Begin VB.TextBox Text1
Enabled = 0 'False
Height = 270
Left = 1470
TabIndex = 6
Top = 255
Width = 1740
End
Begin VB.Label Label5
Caption = "*"
ForeColor = &H000000FF&
Height = 135
Index = 2
Left = 1305
TabIndex = 19
Top = 1035
Width = 255
End
Begin VB.Label Label5
Caption = "*"
ForeColor = &H000000FF&
Height = 135
Index = 1
Left = 1305
TabIndex = 18
Top = 675
Width = 255
End
Begin VB.Label Label5
Caption = "*"
ForeColor = &H000000FF&
Height = 135
Index = 6
Left = 1305
TabIndex = 17
Top = 315
Width = 255
End
Begin VB.Label Label5
Caption = "備注:"
Height = 195
Index = 0
Left = 3645
TabIndex = 5
Top = 607
Width = 915
End
Begin VB.Label Label4
Caption = "經(jīng)手人:"
Height = 195
Left = 3645
TabIndex = 4
Top = 255
Width = 915
End
Begin VB.Label Label3
Caption = "異動地點:"
Height = 195
Left = 285
TabIndex = 3
Top = 960
Width = 915
End
Begin VB.Label Label2
Caption = "異動時間:"
Height = 195
Left = 285
TabIndex = 2
Top = 607
Width = 915
End
Begin VB.Label Label1
Caption = "車牌號碼:"
Height = 195
Left = 285
TabIndex = 1
Top = 255
Width = 915
End
End
End
Attribute VB_Name = "frmcarydlr"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim i As Integer
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
Private Sub cmdAdd_Click()
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
DTPicker1.Visible = True
Adodc1.Enabled = False
i = 1
End Sub
Private Sub cmdCancel_Click()
On Error Resume Next '當沒有添加數(shù)據(jù)的時候 處理異常
Adodc1.Recordset.CancelUpdate
Adodc1.Refresh
Lockctl
cmdok.Enabled = False
cmdCancel.Enabled = False
cmdAdd.Enabled = True
cmdUpdate.Enabled = True
cmdDelete.Enabled = True
DTPicker1.Visible = False
Adodc1.Enabled = True
End Sub
Private Sub cmdDelete_Click()
If MsgBox("您確實要刪除記錄嗎?", vbOKCancel, "系統(tǒng)提示") = vbOK Then
adoCon.Execute ("delete from 車輛異動表 where 車牌號碼='" & Text1 & "'")
MsgBox " 記錄已刪除!", , "系統(tǒng)提示"
Adodc1.Refresh
Adodc1.RecordSource = "select * from 車輛異動表"
Adodc1.Refresh
Text1 = ""
Text2 = ""
Text3 = ""
Text4 = ""
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$("輸入你要查詢的車牌號碼:", "系統(tǒng)提示")
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)
DTPicker1.Value = Adodc1.Recordset.Fields(1)
Text2.Text = Adodc1.Recordset.Fields(2)
Text3.Text = Adodc1.Recordset.Fields(3)
Text4.Text = Adodc1.Recordset.Fields(4)
cmdUpdate.Enabled = True
cmdDelete.Enabled = True
Else
MsgBox "沒有你需要的信息!", , "系統(tǒng)提示"
cmdUpdate.Enabled = False
cmdDelete.Enabled = False
End If
End Sub
Private Sub cmdOk_Click()
Select Case i
Case 1
If Text1.Text = "" Then
MsgBox "車牌號碼不能為空!"
Exit Sub
End If
adoCon.Execute ("insert into 車輛異動表 values ('" & Text1 & "','" & DTPicker1.Value & "','" & Text2 & "','" & Text3 & "','" & Text4 & "')")
MsgBox "記錄添加成功!", , "系統(tǒng)提示"
Adodc1.Refresh
Case 2
adoCon.Execute ("update 車輛異動表 set 車牌號碼='" & Text1.Text & "', 異動地點='" & Text2 & "',經(jīng)手人='" & Text3 & "',備注='" & Text4 & "' where 車牌號碼='" & Text1.Text & "'")
MsgBox "記錄修改成功!", , "系統(tǒng)提示"
Adodc1.Refresh
End Select
Lockctl
cmdok.Enabled = False
cmdCancel.Enabled = False
cmdAdd.Enabled = True
cmdUpdate.Enabled = True
cmdDelete.Enabled = True
DTPicker1.Visible = True
Adodc1.Enabled = True
End Sub
Private Sub cmdUpdate_Click()
Unlockctl
Text1.Enabled = False
i = 2
cmdok.Enabled = True
cmdCancel.Enabled = True
cmdAdd.Enabled = False
cmdDelete.Enabled = False
DTPicker1.Visible = True
Adodc1.Enabled = False
End Sub
Private Sub Command1_Click()
End Sub
Private Sub DTPicker1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then DTPicker1.SetFocus
End Sub
Private Sub Form_Load()
frmcarydlr.Height = 2565
frmcarydlr.Width = 6555
cmdUpdate.Enabled = False
cmdDelete.Enabled = False
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
If Text1.Text = "" Then
MsgBox "車牌號碼不能為空!!", , "系統(tǒng)提示"
Text1.SetFocus
Exit Sub
End If
DTPicker1.SetFocus
End If
End Sub
Private Sub Text1_LostFocus()
If Text1.Text = "" Then Exit Sub
Dim rss As New ADODB.Recordset
Dim rss1 As New ADODB.Recordset
Set rss = adoCon.Execute("select * from 車輛檔案 where 車牌號碼='" & Text1.Text & "'")
If rss.EOF Then
MsgBox "這輛車不屬于本公司的!", , "系統(tǒng)提示"
Text1.Text = ""
Text1.SetFocus
Exit Sub
End If
Dim rss2 As New ADODB.Recordset
Set rss2 = adoCon.Execute("select * from 車輛報廢表 where 車牌號碼='" & Text1.Text & "'")
If rss2.EOF Then
Else
MsgBox "該車已經(jīng)報廢了,不能異動!", , "系統(tǒng)提示"
Text1 = ""
Text1.SetFocus
End If
rss2.Close
Set rss1 = adoCon.Execute("select * from 車輛異動表 where 車牌號碼='" & Text1.Text & "'")
If rss1.EOF Then
Else
MsgBox "此車已經(jīng)添加完異動信息了!", , "系統(tǒng)提示"
Text1.SetFocus
End If
rss.Close
End Sub
Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
If Text2.Text = "" Then
MsgBox "異動地點不能為空!!", , "系統(tǒng)提示"
Text2.SetFocus
Exit Sub
End If
Text3.SetFocus
End If
End Sub
Private Sub Text3_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Text4.SetFocus
End Sub
Private Sub Text4_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then cmdok.SetFocus
End Sub
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -