📄 frmaddstaff.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form frmaddstaff
BackColor = &H00C0FFC0&
BorderStyle = 1 'Fixed Single
Caption = "添加卫生检查工作人员信息"
ClientHeight = 5700
ClientLeft = 4065
ClientTop = 3000
ClientWidth = 9195
LinkTopic = "Form1"
MaxButton = 0 'False
Picture = "frmaddstaff.frx":0000
ScaleHeight = 5700
ScaleWidth = 9195
Begin VB.TextBox Text9
BackColor = &H00C0E0FF&
Height = 495
Left = 7680
TabIndex = 16
Top = 3000
Width = 1335
End
Begin VB.TextBox staffnum
BackColor = &H00C0E0FF&
Height = 495
Left = 480
TabIndex = 15
Top = 1560
Width = 1215
End
Begin VB.CommandButton Command2
BackColor = &H000080FF&
Caption = "取消添加"
BeginProperty Font
Name = "新宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 5280
Style = 1 'Graphical
TabIndex = 12
Top = 4200
Width = 1815
End
Begin VB.CommandButton Command1
BackColor = &H000080FF&
Caption = "确认添加"
BeginProperty Font
Name = "新宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 1440
Style = 1 'Graphical
TabIndex = 11
Top = 4080
Width = 1815
End
Begin MSComctlLib.StatusBar StatusBar1
Align = 2 'Align Bottom
Height = 495
Left = 0
TabIndex = 9
Top = 5205
Width = 9195
_ExtentX = 16219
_ExtentY = 873
_Version = 393216
BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
NumPanels = 1
BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
AutoSize = 1
Object.Width = 16166
Text = "添加卫生检查工作人员"
TextSave = "添加卫生检查工作人员"
EndProperty
EndProperty
End
Begin VB.Frame Frame1
BackColor = &H0080C0FF&
Height = 255
Left = 360
TabIndex = 8
Top = 600
Width = 8175
End
Begin VB.TextBox Text8
BackColor = &H00C0E0FF&
Height = 495
Left = 5880
TabIndex = 7
Top = 3000
Width = 1335
End
Begin VB.TextBox Text7
BackColor = &H00C0E0FF&
Height = 495
Left = 3960
TabIndex = 6
Top = 3000
Width = 1215
End
Begin VB.TextBox Text6
BackColor = &H00C0E0FF&
Height = 495
Left = 2160
TabIndex = 5
Top = 3000
Width = 1215
End
Begin VB.TextBox Text5
BackColor = &H00C0E0FF&
Height = 495
Left = 480
TabIndex = 4
Top = 3000
Width = 1215
End
Begin VB.TextBox Text4
BackColor = &H00C0E0FF&
Height = 495
Left = 7680
TabIndex = 3
Top = 1560
Width = 1215
End
Begin VB.TextBox Text3
BackColor = &H00C0E0FF&
Height = 495
Left = 5880
TabIndex = 2
Top = 1560
Width = 1335
End
Begin VB.TextBox Text2
BackColor = &H00C0E0FF&
Height = 495
Left = 3960
TabIndex = 1
Top = 1560
Width = 1215
End
Begin VB.TextBox Text1
BackColor = &H00C0E0FF&
Height = 495
Left = 2280
TabIndex = 0
Top = 1560
Width = 1215
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "年龄 性别 职位 电话 备注"
BeginProperty Font
Name = "新宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFF00&
Height = 375
Left = 600
TabIndex = 14
Top = 2640
Width = 8175
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = " 编号 栋号 寝室号 姓名 学院"
BeginProperty Font
Name = "新宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFF00&
Height = 375
Left = 480
TabIndex = 13
Top = 1080
Width = 8535
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "添加卫生检查工作人员信息"
BeginProperty Font
Name = "新宋体"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0080FF80&
Height = 375
Left = 2280
TabIndex = 10
Top = 120
Width = 3855
End
End
Attribute VB_Name = "frmaddstaff"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim mrc As ADODB.Recordset
Dim txtSQL As String
Dim MsgText As String
Dim rs As Boolean
rs = True
If Not Testtxt(staffnum.Text) Then
MsgBox "请输入编号", vbOKOnly + vbExclamation, "警告"
staffnum.Text = ""
staffnum.SetFocus
Exit Sub
End If
If Not Testtxt(Text1.Text) Then
MsgBox "请输入栋号!", vbOKOnly + vbExclamation, "警告"
Text1.Text = ""
Text1.SetFocus
Exit Sub
End If
If Not Testtxt(Text2.Text) Then
MsgBox "请输入寝室号!", vbOKOnly + vbExclamation, "警告"
Text2.Text = ""
Text2.SetFocus
Exit Sub
End If
If Not Testtxt(Text3.Text) Then
MsgBox "请输入姓名!", vbOKOnly + vbExclamation, "警告"
Text3.Text = ""
Text3.SetFocus
Exit Sub
End If
If Not Testtxt(Text4.Text) Then
MsgBox "请输入学院!", vbOKOnly + vbExclamation, "警告"
Text4.Text = ""
Text4.SetFocus
Exit Sub
End If
If Not Testtxt(Text5.Text) Then
MsgBox "请输入年龄!", vbOKOnly + vbExclamation, "警告"
Text5.Text = ""
Text5.SetFocus
Exit Sub
End If
If Not Testtxt(Text6.Text) Then
MsgBox "请输入性别!", vbOKOnly + vbExclamation, "警告"
Text6.Text = ""
Text6.SetFocus
Exit Sub
Else
If Text6.Text <> "男" And Text6.Text <> "女" Then
MsgBox "输入性别有错误!", vbOKOnly + vbExclamation, "警告"
Text6.Text = ""
Text6.SetFocus
Exit Sub
End If
End If
If Not Testtxt(Text7.Text) Then
MsgBox "请输入职位!", vbOKOnly + vbExclamation, "警告"
Text7.Text = ""
Text7.SetFocus
Exit Sub
End If
If Not Testtxt(Text8.Text) Then
MsgBox "请输入电话!", vbOKOnly + vbExclamation, "警告"
Text8.Text = ""
Text8.SetFocus
Exit Sub
Else
If Len(Trim(Text8.Text)) <> 7 Then
MsgBox "输入电话号码不正确", vbOKOnly + vbExclamation, "警告"
Text8.Text = ""
Text8.SetFocus
Exit Sub
End If
End If
If Not IsNumeric(Trim(Text1.Text)) Then
MsgBox "栋号请输入数字!", vbOKOnly + vbExclamation, "警告"
Text1.Text = ""
Text1.SetFocus
Exit Sub
End If
If Not IsNumeric(Trim(Text5.Text)) Then
MsgBox "年龄请输入数字!", vbOKOnly + vbExclamation, "警告"
Text5.Text = ""
Text5.SetFocus
rs = False
End If
txtSQL = "select * from hygiene_staff where 编号= '" & staffnum.Text & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If mrc.EOF = False Then
MsgBox "有相同纪录,请重新输入信息!", vbOKOnly + vbExclamation, "警告"
staffnum.Text = ""
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
staffnum.SetFocus
mrc.Close
Else
If rs = True Then
mrc.AddNew
mrc.Fields(0) = staffnum.Text
mrc.Fields(1) = Text1.Text
mrc.Fields(2) = Text2.Text
mrc.Fields(3) = Text3.Text
mrc.Fields(4) = Text4.Text
mrc.Fields(5) = Text5.Text
mrc.Fields(6) = Text6.Text
mrc.Fields(7) = Text7.Text
mrc.Fields(8) = Text8.Text
mrc.Fields(9) = Text9.Text
mrc.Update
mrc.Close
MsgBox "添加信息成功!", vbOKOnly + vbExclamation, "警告"
staffnum.Text = ""
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
staffnum.SetFocus
End If
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Activate()
staffnum.SetFocus
End Sub
Private Sub staffnum_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Text1.SetFocus
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Text2.SetFocus
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Text3.SetFocus
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Text4.SetFocus
End Sub
Private Sub Text4_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Text5.SetFocus
End Sub
Private Sub Text5_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Text6.SetFocus
End Sub
Private Sub Text6_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Text7.SetFocus
End Sub
Private Sub Text7_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Text8.SetFocus
End Sub
Private Sub Text8_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Text9.SetFocus
End Sub
Private Sub Text9_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Command1.SetFocus
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -