📄 添加系部信息.frm
字号:
VERSION 5.00
Begin VB.Form 添加系部信息
Caption = "Form1"
ClientHeight = 4110
ClientLeft = 60
ClientTop = 345
ClientWidth = 4350
LinkTopic = "Form1"
ScaleHeight = 4110
ScaleWidth = 4350
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command3
Caption = "清除"
Height = 495
Left = 1440
TabIndex = 6
Top = 3360
Width = 1575
End
Begin VB.CommandButton Command2
Caption = " 取消"
Height = 495
Left = 2280
TabIndex = 5
Top = 2520
Width = 1455
End
Begin VB.CommandButton Command1
Caption = "添加"
Height = 495
Left = 240
TabIndex = 4
Top = 2520
Width = 1455
End
Begin VB.TextBox Text2
Height = 495
Left = 2160
TabIndex = 3
Text = " "
Top = 1080
Width = 1455
End
Begin VB.TextBox Text1
Height = 495
Left = 2160
TabIndex = 2
Text = " "
Top = 240
Width = 1455
End
Begin VB.Label Label2
Caption = "系部名称"
Height = 495
Left = 120
TabIndex = 1
Top = 1080
Width = 1455
End
Begin VB.Label Label1
Caption = "系部编号 "
Height = 495
Left = 120
TabIndex = 0
Top = 240
Width = 1455
End
End
Attribute VB_Name = "添加系部信息"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs20 As New ADODB.Recordset
Private Sub Command1_Click()
If rs20.State <> 0 Then rs20.Close
rs20.Open "select * from 系部表 where 系部编号='" & Trim(Text1) & "'", cnn, 3, 3
rs20.Find "系部编号= '" & Trim(Text1) & "'"
If rs20.EOF = False Then
MsgBox "对不起,您要信息已经存在,请重新输入!"
Text1 = ""
End If
If rs20.State <> 0 Then rs20.Close
rs20.Open "select * from 系部表 ", cnn, 3, 3
rs20.AddNew
rs20("系部编号") = Trim(Text1)
rs20("系部名称") = Trim(Text2)
rs20.Update
rs20.Requery
MsgBox "添加成功!"
Text1 = ""
Text2 = ""
End Sub
Private Sub Command2_Click()
Me.Hide
End Sub
Private Sub Command3_Click()
Text1 = ""
Text2 = ""
Text1.SetFocus
End Sub
Private Sub Form_Load()
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
rs12.Find "系部编号='" + Trim(Text1) + "'"
If Not rs20.EOF() Then
Text2 = rs20("系部名称")
Text1 = rs20("系部编号")
End If
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -