📄 drivers.frm
字号:
VERSION 5.00
Begin VB.Form Drivers
BackColor = &H80000013&
Caption = "Drivers"
ClientHeight = 8400
ClientLeft = 60
ClientTop = 450
ClientWidth = 11865
BeginProperty Font
Name = "BankGothic Md BT"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
MDIChild = -1 'True
ScaleHeight = 8400
ScaleWidth = 11865
WindowState = 2 'Maximized
Begin VB.ComboBox cboemp_no
BeginProperty Font
Name = "BankGothic Md BT"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Left = 7680
Locked = -1 'True
TabIndex = 12
Top = 1920
Width = 2055
End
Begin OnTheSpot.isButton cmdsave
Height = 495
Left = 8160
TabIndex = 11
Top = 4800
Width = 1695
_ExtentX = 2990
_ExtentY = 873
Icon = "Drivers.frx":0000
Style = 7
Caption = "Save"
iNonThemeStyle = 0
ShowFocus = -1 'True
USeCustomColors = -1 'True
BackColor = 14737632
HighlightColor = 0
FontColor = 128
Tooltiptitle = ""
ToolTipIcon = 0
ToolTipType = 1
ttForeColor = 0
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "BankGothic Md BT"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
MaskColor = 0
RoundedBordersByTheme= 0 'False
End
Begin OnTheSpot.isButton cmdadd
Height = 495
Left = 8160
TabIndex = 10
Top = 4200
Width = 1695
_ExtentX = 2990
_ExtentY = 873
Icon = "Drivers.frx":001C
Style = 7
Caption = "Add"
iNonThemeStyle = 0
ShowFocus = -1 'True
USeCustomColors = -1 'True
BackColor = 14737632
HighlightColor = 0
FontColor = 128
Tooltiptitle = ""
ToolTipIcon = 0
ToolTipType = 1
ttForeColor = 0
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "BankGothic Md BT"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
MaskColor = 0
End
Begin VB.TextBox txtdriver1d
Appearance = 0 'Flat
BackColor = &H80000013&
BorderStyle = 0 'None
BeginProperty Font
Name = "BankGothic Md BT"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000C0&
Height = 255
Left = 7680
TabIndex = 8
Top = 1560
Width = 495
End
Begin VB.TextBox txtmobile
BeginProperty Font
Name = "BankGothic Md BT"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 285
Left = 7680
TabIndex = 7
Top = 3000
Width = 2055
End
Begin VB.TextBox txtfirstname
BeginProperty Font
Name = "BankGothic Md BT"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 285
Left = 7680
TabIndex = 4
Top = 2280
Width = 2055
End
Begin VB.ListBox lstdrivers
BeginProperty Font
Name = "Papyrus"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 2340
Left = 3360
TabIndex = 1
Top = 1560
Width = 1935
End
Begin VB.TextBox txtlastname
BeginProperty Font
Name = "BankGothic Md BT"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 285
Left = 7680
TabIndex = 0
Top = 2640
Width = 2055
End
Begin OnTheSpot.isButton cmddelete
Height = 495
Left = 8160
TabIndex = 13
Top = 5400
Width = 1695
_ExtentX = 2990
_ExtentY = 873
Icon = "Drivers.frx":0038
Style = 7
Caption = "Delete"
iNonThemeStyle = 0
USeCustomColors = -1 'True
HighlightColor = 0
FontColor = 64
Tooltiptitle = ""
ToolTipIcon = 0
ToolTipType = 1
ttForeColor = 0
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "BankGothic Md BT"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
MaskColor = 0
RoundedBordersByTheme= 0 'False
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "DRIVER ID:"
BeginProperty Font
Name = "BankGothic Md BT"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 6240
TabIndex = 9
Top = 1560
Width = 1215
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = " Mobile"
BeginProperty Font
Name = "BankGothic Md BT"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 2
Left = 6120
TabIndex = 6
Top = 3000
Width = 1455
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = " Last Name"
BeginProperty Font
Name = "BankGothic Md BT"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 1
Left = 6120
TabIndex = 5
Top = 2640
Width = 1575
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = " First Name"
BeginProperty Font
Name = "BankGothic Md BT"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 0
Left = 6120
TabIndex = 3
Top = 2280
Width = 1575
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = " Employee Id"
BeginProperty Font
Name = "BankGothic Md BT"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 6120
TabIndex = 2
Top = 1920
Width = 1455
End
End
Attribute VB_Name = "Drivers"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim cn As ADODB.Connection
Dim RS As ADODB.Recordset, rs1 As ADODB.Recordset, rs2 As ADODB.Recordset, rs3 As ADODB.Recordset
Dim add As Boolean
Private Sub cmdadd_Click()
clear
cboemp_no.Locked = False
Set rs2 = New ADODB.Recordset
rs2.Open "select * from employee", cn, adOpenDynamic, adLockPessimistic
Do Until rs2.EOF = True
cboemp_no.AddItem rs2("employee_number")
rs2.MoveNext
Loop
add = True
End Sub
Private Sub cmddelete_Click()
'do the actual deleting
Set rs3 = New ADODB.Recordset
rs3.Open "select * from Driver where first_name = '" & txtfirstname.Text & "', cn"
rs3.Delete
'move the cursor from the deleted record.
lstdrivers.clear
popul8_list
End Sub
Private Sub cmdsave_Click()
cboemp_no.Locked = True
If add = True Then
add = False
RS.AddNew
RS!emp_number = cboemp_no.Text
RS!first_name = txtfirstname.Text
RS!last_name = txtlastname.Text
RS!mobile = txtmobile.Text
RS.Update
lstdrivers.clear
cboemp_no.clear
popul8_list
Display
Else: End If
End Sub
Private Sub Form_Load()
On Error Resume Next
Set cn = New ADODB.Connection
Set RS = New ADODB.Recordset
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=TRANSPORT.MDB;Persist Security Info=False"
RS.Open "select * from Driver", cn, adOpenDynamic, adLockPessimistic
RS.MoveFirst
popul8_list
Display
If Err Then
MsgBox Err.Number + Err.Description
End If
End Sub
Public Sub popul8_list()
Do Until RS.EOF = True
lstdrivers.AddItem RS("first_name")
RS.MoveNext
Loop
RS.MoveFirst
End Sub
Private Sub lstadmin_Click()
cmddelete.Enabled = True
Display
End Sub
Public Sub Display()
'txtfirstname.Text = (lstdrivers.List(lstdrivers.ListIndex))
txtdriver1d.Text = RS("Driver_ID")
cboemp_no.Text = RS("emp_number")
txtfirstname.Text = RS("first_name")
txtlastname.Text = RS("last_name")
txtmobile.Text = RS("mobile")
End Sub
Private Sub lstdrivers_Click()
Set rs1 = New ADODB.Recordset
rs1.Open "select * from Driver where first_name='" & lstdrivers.List(lstdrivers.ListIndex) & "'", cn, adOpenDynamic, adLockPessimistic
txtdriver1d.Text = rs1("Driver_ID")
cboemp_no.Text = rs1("emp_number")
txtfirstname.Text = rs1("first_name")
txtlastname.Text = rs1("last_name")
txtmobile.Text = rs1("mobile")
rs1.Close
End Sub
Public Sub clear()
txtdriver1d.Text = ""
cboemp_no.Text = ""
txtfirstname.Text = ""
txtlastname.Text = ""
txtmobile.Text = ""
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -