?? frmdriver.frm
字號(hào):
VERSION 5.00
Begin VB.Form frmdriver
BorderStyle = 3 'Fixed Dialog
Caption = "司機(jī)信息"
ClientHeight = 4080
ClientLeft = 3270
ClientTop = 2025
ClientWidth = 8565
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 4080
ScaleWidth = 8565
ShowInTaskbar = 0 'False
Begin VB.CommandButton cmdexit
Caption = "返 回"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 5760
TabIndex = 20
Top = 3360
Width = 1455
End
Begin VB.CommandButton Cmdsave
Caption = "保 存"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 4080
TabIndex = 19
Top = 3360
Width = 1335
End
Begin VB.Frame Frame2
Caption = "駕照信息"
Height = 2535
Left = 4080
TabIndex = 1
Top = 480
Width = 4215
Begin VB.TextBox txtitem
Height = 270
Index = 8
Left = 1800
TabIndex = 18
Top = 1920
Width = 1815
End
Begin VB.TextBox txtitem
Height = 270
Index = 7
Left = 1800
TabIndex = 17
Top = 1560
Width = 1815
End
Begin VB.TextBox txtitem
Height = 270
Index = 6
Left = 1800
TabIndex = 16
Top = 1200
Width = 1815
End
Begin VB.TextBox txtitem
Height = 270
Index = 0
Left = 1800
TabIndex = 15
Top = 840
Width = 1815
End
Begin VB.TextBox txtitem
Height = 270
Index = 5
Left = 1800
TabIndex = 14
Top = 480
Width = 1815
End
Begin VB.Label Label9
Caption = "有效期結(jié)束日期"
Height = 255
Left = 240
TabIndex = 13
Top = 1920
Width = 1335
End
Begin VB.Label Label8
Caption = "有效期起始日期"
Height = 255
Left = 240
TabIndex = 12
Top = 1560
Width = 1335
End
Begin VB.Label Label7
Caption = "準(zhǔn)駕車型"
Height = 255
Left = 240
TabIndex = 11
Top = 1200
Width = 855
End
Begin VB.Label Label6
Caption = "執(zhí)照號(hào)碼"
Height = 255
Left = 240
TabIndex = 10
Top = 840
Width = 855
End
Begin VB.Label Label5
Caption = "考照時(shí)間"
Height = 255
Left = 240
TabIndex = 9
Top = 480
Width = 855
End
End
Begin VB.Frame Frame1
Caption = "司機(jī)基本信息"
Height = 2535
Left = 240
TabIndex = 0
Top = 480
Width = 3735
Begin VB.ComboBox Cobsex
Height = 300
Left = 1080
TabIndex = 21
Top = 840
Width = 2175
End
Begin VB.TextBox txtitem
Height = 495
Index = 4
Left = 1080
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 8
Top = 1800
Width = 2145
End
Begin VB.TextBox txtitem
Height = 270
Index = 3
Left = 1080
TabIndex = 7
Top = 1320
Width = 2175
End
Begin VB.TextBox txtitem
Height = 270
Index = 1
Left = 1080
TabIndex = 6
Top = 360
Width = 2175
End
Begin VB.Label Label4
Caption = "家庭住址"
Height = 255
Left = 240
TabIndex = 5
Top = 1800
Width = 855
End
Begin VB.Label Label3
Caption = "出生年月"
Height = 255
Left = 240
TabIndex = 4
Top = 1320
Width = 735
End
Begin VB.Label Label2
Alignment = 2 'Center
Caption = "性別"
Height = 255
Left = 120
TabIndex = 3
Top = 840
Width = 615
End
Begin VB.Label Label1
Alignment = 2 'Center
Caption = "姓名"
Height = 255
Left = 120
TabIndex = 2
Top = 360
Width = 615
End
End
End
Attribute VB_Name = "frmdriver"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim mblChange As Boolean '是否改動(dòng)過記錄,ture為改過
Dim mrc As ADODB.Recordset
Public txtsql As String '操作的表名稱
Private Sub cmdexit_Click()
If mblChange And Cmdsave.Enabled Then
If MsgBox("記錄已經(jīng)修改,是否保存? ", vbOKCancel + vbExclamation, "警告") = vbOK Then
Call Cmdsave_Click
End If
End If
Unload Me
End Sub
Private Sub Cmdsave_Click()
' Dim mrc As ADODB.Recordset
Dim intCount As Integer ' 計(jì)數(shù)器
' Dim smeg As String
'Dim sSql As String
Dim msgtext As String '返回execute函數(shù)值
For intCount = 0 To 1 '判斷駕照和姓名是否為空
If Trim(txtitem(intCount) & "") = "" Then
Select Case intCount
Case 0
MsgBox "執(zhí)照號(hào)碼不能為空!", vbOKOnly + vbExclamation, "警告"
txtitem(intCount).SetFocus
Case 1
MsgBox "姓名不能為空!", vbOKOnly + vbExclamation, "警告"
txtitem(intCount).SetFocus
End Select
Exit Sub
End If
Next intCount
If Trim(txtitem(6) & "") = "" Then
MsgBox "準(zhǔn)駕車型不能為空", vbOKOnly + vbExclamation, "警告"
txtitem(6).SetFocus
Exit Sub
End If
If Trim(txtitem(8) & "") <> "" Then '有效的結(jié)束時(shí)間
If Not IsDate(txtitem(8)) Then
MsgBox "時(shí)間格式輸入有勿,請(qǐng)按(yyyy-mm-dd)格式輸入", vbOKOnly + vbExclamation, "警告"
txtitem(8).SetFocus
Exit Sub
Else
txtitem(8) = Format(txtitem(8), "yyyy-mm-dd")
End If
End If
If Trim(txtitem(7) & "") <> "" Then '有效的開始時(shí)間
If Not IsDate(txtitem(7)) Then
MsgBox "時(shí)間格式輸入有勿,請(qǐng)按(yyyy-mm-dd)格式輸入", vbOKOnly + vbExclamation, "警告"
txtitem(7).SetFocus
Exit Sub
Else
txtitem(7) = Format(txtitem(7), "yyyy-mm-dd")
End If
End If
If Trim(txtitem(5) & "") <> "" Then '判斷考出駕照的時(shí)間格式
If Not IsDate(txtitem(8)) Then
MsgBox "時(shí)間格式輸入有勿,請(qǐng)按(yyyy-mm-dd)格式輸入", vbOKOnly + vbExclamation, "警告"
txtitem(5).SetFocus
Exit Sub
Else
txtitem(5) = Format(txtitem(5), "yyyy-mm-dd")
End If
End If
If Trim(txtitem(3) & "") <> "" Then '判斷出生年月的時(shí)間格式
If Not IsDate(txtitem(3)) Then
MsgBox "時(shí)間格式輸入有勿,請(qǐng)按(yyyy-mm-dd)格式輸入", vbOKOnly + vbExclamation, "警告"
txtitem(8).SetFocus
Exit Sub
Else
txtitem(3) = Format(txtitem(3), "yyyy-mm-dd")
End If
End If
If gintdMode = 1 Then '查詢是否有相同的記錄
txtsql = "select * from driver where sj_id='" & Trim(txtitem(0)) & "'"
Set mrc = ExecuteSQL(txtsql, msgtext)
If mrc.EOF = False Then
MsgBox "此執(zhí)照號(hào)碼已經(jīng)存在記錄!", vbOKOnly + vbExclamation, "警告"
txtitem(0).SetFocus
Exit Sub
Else
mrc.AddNew
mrc.Fields(0) = Trim(txtitem(0))
mrc.Fields(1) = Trim(txtitem(1))
mrc.Fields(2) = Cobsex.Text
For intCount = 3 To 8
mrc.Fields(intCount) = Trim(txtitem(intCount))
Next intCount
mrc.Update
End If
mrc.Close
MsgBox "添加信息成功", vbOKOnly + vbExclamation, "添加信息"
End If
If gintdMode = 2 Then
txtsql = "delete from driver where sj_id='" & Trim(txtitem(0)) & "'"
ExecuteSQL txtsql, msgtext
txtsql = "select * from driver"
Set mrc = ExecuteSQL(txtsql, msgtext) '刪除原來的記錄
mrc.AddNew
mrc.Fields(0) = Trim(txtitem(0))
mrc.Fields(1) = Trim(txtitem(1))
mrc.Fields(2) = Cobsex.Text
For intCount = 3 To 8
mrc.Fields(intCount) = Trim(txtitem(intCount))
Next intCount
mrc.Update '更新記錄
mrc.Close
flagdEdit = True
MsgBox "修改信息成功", vbOKOnly + vbExclamation, "修改信息"
End If
If gintdMode = 1 Then '添加狀態(tài)則清空文本框
txtitem(0) = ""
txtitem(1) = ""
Cobsex.Text = ""
For intCount = 3 To 8
txtitem(intCount) = ""
Next intCount
mblChange = False
End If
If gintdMode = 2 Then
Unload Me
If flagdEdit Then
Unload frmdriverlist
End If
frmdriverlist.txtsql = "select * from driver" '重新載入數(shù)據(jù)
frmdriverlist.Show
End If
End Sub
Private Sub Form_Load()
'Dim mrc As ADODB.Recordset
'Dim sSql As String
Dim Count As Integer
Dim msgtext As String
Cobsex.AddItem "男", 0
Cobsex.AddItem "女", 1
Me.Left = 3225
Me.Top = 1695
If gintdMode = 1 Then
Me.Caption = Me.Caption & "添加"
ElseIf gintdMode = 2 Then
Set mrc = ExecuteSQL(txtsql, msgtext)
If mrc.EOF = False Then
With mrc
If (.Fields(0) & "") <> "" And (.Fields(1) & "") <> "" And (.Fields(2) & "") <> "" Then
txtitem(0) = .Fields(0)
txtitem(1) = .Fields(1)
Cobsex.Text = .Fields(2)
End If
For Count = 3 To 8
If (.Fields(Count) & "") <> "" Then '判斷數(shù)據(jù)是否為空
txtitem(Count) = .Fields(Count) '賦值
End If
Next Count
End With
txtitem(0).Enabled = False
End If
mrc.Close
Me.Caption = Me.Caption & "修改"
End If
mblChange = False
End Sub
Private Sub Form_Unload(Cancel As Integer)
gintdMode = 0
End Sub
Private Sub txtitem_Change(Index As Integer)
mblChange = True
End Sub
Private Sub txtitem_GotFocus(Index As Integer)
txtitem(Index).SelStart = 0
txtitem(Index).SelLength = Len(txtitem(Index))
End Sub
Private Sub txtitem_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
EnterToTab KeyCode
End Sub
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -