📄 main_ksgl_update.frm
字号:
VERSION 5.00
Begin VB.Form Main_Ksgl_Update
BackColor = &H00E3D9E6&
ClientHeight = 4365
ClientLeft = 60
ClientTop = 60
ClientWidth = 6810
ControlBox = 0 'False
LinkTopic = "Form1"
ScaleHeight = 4365
ScaleWidth = 6810
StartUpPosition = 1 '所有者中心
Begin VB.CommandButton CmdCancel
Caption = "(&C)取消"
Height = 375
Left = 3450
TabIndex = 0
Top = 3825
Width = 1830
End
Begin VB.CommandButton CmdSave
Caption = "(&M)修改"
Height = 375
Left = 1635
TabIndex = 1
Top = 3825
Width = 1830
End
Begin VB.Frame Frame1
BackColor = &H00FFC0C0&
Caption = "修改科室信息"
BeginProperty Font
Name = "隶书"
Size = 15
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C000C0&
Height = 3435
Left = 225
TabIndex = 2
Top = 195
Width = 6390
Begin VB.TextBox Text1
BackColor = &H00FFFFFF&
Height = 285
Index = 0
Left = 1110
Locked = -1 'True
TabIndex = 8
Top = 615
Width = 2055
End
Begin VB.TextBox Text1
Height = 285
Index = 1
Left = 1110
TabIndex = 7
Top = 990
Width = 5040
End
Begin VB.TextBox Text1
BeginProperty DataFormat
Type = 1
Format = """¥""#,##0.00;(""¥""#,##0.00)"
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 2
EndProperty
Height = 285
Index = 3
Left = 1110
TabIndex = 6
Top = 1785
Width = 5040
End
Begin VB.TextBox Text1
Height = 285
Index = 2
Left = 1110
TabIndex = 5
Top = 1380
Width = 5040
End
Begin VB.ComboBox Combo1
Height = 300
Left = 1095
TabIndex = 4
Top = 2580
Width = 5040
End
Begin VB.TextBox Text1
BeginProperty DataFormat
Type = 1
Format = """¥""#,##0.00;(""¥""#,##0.00)"
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 2
EndProperty
Height = 285
Index = 4
Left = 1110
TabIndex = 3
Top = 2190
Width = 5040
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "科室名称 基础工资 "
ForeColor = &H00FF0000&
Height = 330
Left = 255
TabIndex = 14
Top = 1050
Width = 765
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "科室编号 "
ForeColor = &H00FF0000&
Height = 330
Left = 255
TabIndex = 13
Top = 675
Width = 870
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "科室简称 基础工资 "
ForeColor = &H00FF0000&
Height = 330
Left = 255
TabIndex = 12
Top = 1440
Width = 765
End
Begin VB.Label Label5
BackStyle = 0 'Transparent
Caption = "拼音码 基础工资 "
ForeColor = &H00FF0000&
Height = 330
Left = 255
TabIndex = 11
Top = 1830
Width = 765
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
Caption = "科室类型 基础工资 "
ForeColor = &H00FF0000&
Height = 330
Left = 255
TabIndex = 10
Top = 2655
Width = 765
End
Begin VB.Label Label6
BackStyle = 0 'Transparent
Caption = "科室电话 基础工资 "
ForeColor = &H00FF0000&
Height = 330
Left = 255
TabIndex = 9
Top = 2235
Width = 765
End
End
End
Attribute VB_Name = "Main_Ksgl_Update"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim i As Integer
Dim SQL As String
Private Sub Form_Activate()
Text1(1).SetFocus
End Sub
Private Sub Form_Load()
Combo1.AddItem ("临床")
Combo1.AddItem ("医技")
Combo1.AddItem ("后勤")
Combo1.AddItem ("行政")
Combo1.AddItem ("其他")
For i = 0 To 4
'对应列
Main_Ksgl.MSHFlexGrid1.Col = i
Text1(i).Text = Main_Ksgl.MSHFlexGrid1.Text
Next i
Main_Ksgl.MSHFlexGrid1.Col = 5
Combo1.Text = Main_Ksgl.MSHFlexGrid1.Text
End Sub
Private Sub Text1_GotFocus(Index As Integer)
GotFocusBC Text1(Index)
End Sub
Private Sub Text1_LostFocus(Index As Integer)
LostFocusBC Text1(Index)
End Sub
Private Sub Text1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
If Index < 4 And KeyCode = vbKeyReturn Then Text1(Index + 1).SetFocus
If Index = 4 And KeyCode = vbKeyReturn Then Combo1.SetFocus
If Index <> 0 And KeyCode = vbKeyUp Then Text1(Index - 1).SetFocus
End Sub
Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then CmdSave.SetFocus
End Sub
Private Sub CmdSave_Click()
Dim cn As New ADODB.Connection
cn.Open cnn
If Text1(0).Text = "" Then
MsgBox "系统不允许科室名称!"
Exit Sub
End If
'生成SQL语句
SQL = "UPDATE 科室信息表 SET 科室名称 ='" + Text1(1).Text + "',科室简称 = '" + Text1(2).Text + "',拼音码= '" + Text1(3).Text + "',科室类型 ='" + Combo1.Text + "',科室电话 ='" + Text1(4).Text + "' WHERE 科室编号='" + Text1(0).Text + "'"
'执行SQL
cn.Execute SQL
cn.Close
Main_Ksgl.Adodc1.Refresh
Unload Me
EnaT Main_Ksgl
End Sub
Private Sub CmdCancel_Click()
EnaT Main_Ksgl
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -