📄 frm_bumen_edit.frm
字号:
VERSION 5.00
Begin VB.Form Frm_bumen_edit
BorderStyle = 1 'Fixed Single
Caption = "修改部门"
ClientHeight = 1575
ClientLeft = 4530
ClientTop = 3330
ClientWidth = 3225
Icon = "Frm_bumen_edit.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1575
ScaleWidth = 3225
StartUpPosition = 1 '所有者中心
Begin VB.TextBox Text1
Height = 300
Left = 1200
TabIndex = 2
Top = 300
Width = 1695
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 375
Left = 360
TabIndex = 1
Top = 960
Width = 915
End
Begin VB.CommandButton Command2
Cancel = -1 'True
Caption = "取消"
Height = 375
Left = 1800
TabIndex = 0
Top = 960
Width = 975
End
Begin VB.Label Label1
Caption = "部门名称"
Height = 255
Left = 180
TabIndex = 3
Top = 360
Width = 915
End
End
Attribute VB_Name = "Frm_bumen_edit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
On Error GoTo myerr
Dim cn As ADODB.Connection
Dim rst As New ADODB.Recordset
Dim sql As String
If Trim(Text1) = "" Then
MsgBox "部门名称不能为空!", vbExclamation, "提示"
Text1.SetFocus
Exit Sub
End If
If Len(Text1) > 50 Then
MsgBox "部门名称不能超过50个字符!", vbExclamation, "提示"
Text1.SetFocus
Exit Sub
End If
Set cn = GetCn
sql = "select * from bumen where bmmc='" & Trim(Text1) & "'"
rst.Open sql, cn, 0, 1
If Not (rst.BOF And rst.EOF) Then
MsgBox "该名称已存在!", vbExclamation, "提示"
Text1.SetFocus
rst.Close
cn.Close
Exit Sub
End If
rst.Close
sql = "update bumen set bmmc='" & Trim(Text1) & "' where bmdm=" & Frm_bumen.ListView1.SelectedItem.Text
cn.Execute sql
Frm_bumen.ListView1.SelectedItem.SubItems(1) = Trim(Text1)
MsgBox "保存成功!", vbExclamation, "提示"
Unload Me
Exit Sub
myerr:
MsgBox Error, vbExclamation, "提示"
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Text1 = Frm_bumen.ListView1.SelectedItem.SubItems(1)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -