?? frmdeletedept.frm
字號:
VERSION 5.00
Begin VB.Form frmUpdateDept
Caption = "刪改部門信息"
ClientHeight = 3510
ClientLeft = 60
ClientTop = 345
ClientWidth = 4095
LinkTopic = "Form1"
ScaleHeight = 3510
ScaleWidth = 4095
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton cmdCancel
Caption = "返回(&C)"
Height = 375
Left = 2280
TabIndex = 13
Top = 3000
Width = 735
End
Begin VB.CommandButton cmdDelete
Caption = "刪除(&D)"
Height = 375
Left = 1080
TabIndex = 12
Top = 3000
Width = 735
End
Begin VB.Frame Frame2
Caption = "部門基本信息"
Height = 1695
Left = 120
TabIndex = 3
Top = 120
Width = 3855
Begin VB.TextBox txtNo
Appearance = 0 'Flat
Enabled = 0 'False
Height = 285
Left = 1080
TabIndex = 11
Text = "Text1"
Top = 240
Width = 2535
End
Begin VB.TextBox txtOffice
Appearance = 0 'Flat
Enabled = 0 'False
Height = 285
Left = 1080
TabIndex = 9
Text = "Text3"
Top = 1320
Width = 2535
End
Begin VB.TextBox txtTel
Appearance = 0 'Flat
Enabled = 0 'False
Height = 285
Left = 1080
TabIndex = 7
Text = "Text2"
Top = 960
Width = 2535
End
Begin VB.TextBox txtName
Appearance = 0 'Flat
Enabled = 0 'False
Height = 285
Left = 1080
TabIndex = 5
Text = "Text1"
Top = 600
Width = 2535
End
Begin VB.Label Label4
Caption = "部門編號:"
Height = 255
Left = 240
TabIndex = 10
Top = 240
Width = 975
End
Begin VB.Label Label3
Caption = "辦 公 室:"
Height = 255
Left = 240
TabIndex = 8
Top = 1320
Width = 975
End
Begin VB.Label Label2
Caption = "部門電話:"
Height = 255
Left = 240
TabIndex = 6
Top = 960
Width = 975
End
Begin VB.Label Label1
Caption = "部門名稱:"
Height = 255
Index = 1
Left = 240
TabIndex = 4
Top = 600
Width = 975
End
End
Begin VB.Frame Frame1
Caption = "選擇"
Height = 855
Left = 120
TabIndex = 0
Top = 1920
Width = 3855
Begin VB.ComboBox cboDept
Height = 315
Left = 1080
TabIndex = 1
Text = "Combo1"
Top = 360
Width = 2535
End
Begin VB.Label Label1
Caption = "選擇部門:"
Height = 255
Index = 0
Left = 120
TabIndex = 2
Top = 360
Width = 1815
End
End
End
Attribute VB_Name = "frmUpdateDept"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public sqlStr As String
Public msgText As String
Private Sub cboDept_Click()
Dim rstDepartment As ADODB.Recordset
sqlStr = "select * from department where departName='" & cboDept.Text & "'"
Set rstDepartment = ExecuteSQL(sqlStr, msgText)
If Not rstDepartment.EOF Then
txtNo.Text = Trim(rstDepartment.Fields("no"))
txtName.Text = Trim(rstDepartment.Fields("departName"))
txtTel.Text = Trim(rstDepartment.Fields("telno"))
txtOffice.Text = Trim(rstDepartment.Fields("roomNo"))
Else
MsgBox "沒有找到相關數據!", vbOKOnly + vbExclamation, "警告"
Exit Sub
End If
rstDepartment.Close
End Sub
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdDelete_Click()
Dim rstDepartment As ADODB.Recordset
cboDept.Clear
'初始化部門列表
sqlStr = "delete from department where no=" & txtNo.Text
Set rstDepartment = ExecuteSQL(sqlStr, msgText)
End Sub
Private Sub Form_Load()
initForm
End Sub
Sub initDept()
Dim rstDepartment As ADODB.Recordset
cboDept.Clear
'初始化部門列表
sqlStr = "select departName from department"
Set rstDepartment = ExecuteSQL(sqlStr, msgText)
If Not rstDepartment.EOF Then
Do While Not rstDepartment.EOF
cboDept.AddItem Trim(rstDepartment.Fields(0))
rstDepartment.MoveNext
Loop
cboDept.ListIndex = 0
Else
MsgBox "請添加客房類型!", vbOKOnly + vbExclamation, "警告"
Exit Sub
End If
rstDepartment.Close
End Sub
Sub initForm()
txtNo = ""
txtName = ""
txtTel = ""
txtOffice = ""
initDept
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -