📄 frmyg.frm
字号:
VERSION 5.00
Begin VB.Form frmyg
BorderStyle = 3 'Fixed Dialog
Caption = "员工管理"
ClientHeight = 5520
ClientLeft = 45
ClientTop = 330
ClientWidth = 5895
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 5520
ScaleWidth = 5895
ShowInTaskbar = 0 'False
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame2
Height = 855
Left = 240
TabIndex = 15
Top = 4440
Width = 5415
Begin VB.CommandButton Command1
Caption = "重设"
Height = 375
Left = 1080
TabIndex = 12
Top = 240
Width = 975
End
Begin VB.CommandButton Command2
Caption = "保存"
Height = 375
Left = 2340
TabIndex = 13
Top = 240
Width = 975
End
Begin VB.CommandButton Command3
Caption = "返回"
Height = 375
Left = 3600
TabIndex = 14
Top = 240
Width = 975
End
End
Begin VB.Frame Frame1
Caption = "员工信息管理"
Height = 3975
Left = 240
TabIndex = 0
Top = 240
Width = 5415
Begin VB.TextBox Text
Height = 270
Index = 0
Left = 1560
TabIndex = 16
Top = 480
Width = 1935
End
Begin VB.ComboBox Combo1
Height = 300
ItemData = "frmyg.frx":0000
Left = 1560
List = "frmyg.frx":000A
TabIndex = 8
Text = "男性"
Top = 1200
Width = 1335
End
Begin VB.TextBox Text
Height = 1095
Index = 4
Left = 240
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 11
Top = 2640
Width = 4935
End
Begin VB.TextBox Text
Height = 270
Index = 3
Left = 1560
TabIndex = 10
Top = 1920
Width = 1935
End
Begin VB.TextBox Text
Height = 270
Index = 2
Left = 1560
TabIndex = 9
Top = 1560
Width = 1935
End
Begin VB.TextBox Text
Height = 270
Index = 1
Left = 1560
TabIndex = 7
Top = 840
Width = 1935
End
Begin VB.Label Label
Caption = "备注:"
Height = 255
Index = 5
Left = 360
TabIndex = 6
Top = 2280
Width = 975
End
Begin VB.Label Label
Caption = "住址:"
Height = 255
Index = 4
Left = 360
TabIndex = 5
Top = 1920
Width = 975
End
Begin VB.Label Label
Caption = "电话:"
Height = 255
Index = 3
Left = 360
TabIndex = 4
Top = 1560
Width = 975
End
Begin VB.Label Label
Caption = "性别:"
Height = 255
Index = 2
Left = 360
TabIndex = 3
Top = 1200
Width = 975
End
Begin VB.Label Label
Caption = "姓名:"
Height = 255
Index = 1
Left = 360
TabIndex = 2
Top = 840
Width = 975
End
Begin VB.Label Label
Caption = "员工编号:"
Height = 255
Index = 0
Left = 360
TabIndex = 1
Top = 480
Width = 975
End
End
End
Attribute VB_Name = "frmyg"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'****************************************************************************
'人人为我,我为人人
'枕善居收藏整理
'发布日期:2006/12/06
'描 述: 纯净水进销存管理系统 Ver 2.0
'网 站:http://www.Mndsoft.com/ (VB6源码博客)
'网 站:http://www.VbDnet.com/ (VB.NET源码博客,主要基于.NET2005)
'e-mail :Mndsoft@163.com
'e-mail :Mndsoft@126.com
'OICQ :88382850
' 如果您有新的好的代码别忘记给枕善居哦!
'****************************************************************************
Private Sub Command1_Click()
Dim i As Integer
For i = 0 To 4
Text(i).Text = ""
Next
End Sub
Private Sub Command2_Click()
Dim i As Integer
Dim rsyg As ADODB.Recordset
For i = 0 To 3
If Text(i).Text = "" Then
MsgBox "前四项不能为空", vbExclamation, "系统提示"
Exit Sub
End If
Next
Dim sqlyg As String
'///构建SQL语句
If ygEdit <> 1 Then
sqlyg = "select * from 员工表 where 员工编号='" & Trim(Text(0).Text) & "'"
Set rsyg = ExeSQL(sqlyg)
If Not rsyg.EOF Then
MsgBox "已经存在编号为" & Trim(Text(0).Text) & "的员工记录,请重输!", vbYesNo, "系统提示"
rsyg.Close
Set rsyg = Nothing
Exit Sub
End If
sqlyg = "insert into 员工表(员工编号,姓名,性别,电话,地址,备注) values('"
sqlyg = sqlyg & Trim(Text(0).Text) & "','" & Trim(Text(1).Text) & "','" & Trim(Combo1.Text) & "','"
sqlyg = sqlyg & Trim(Text(2).Text) & "','" & Trim(Text(3).Text)
If Text(4).Text <> "" Then
sqlyg = sqlyg & "','" & Trim(Text(4).Text) & "')"
Else
sqlyg = sqlyg & "','" & "null" & "')"
End If
Else
Dim oldYGid As String
Dim sqlUpData As String
oldYGid = Trim(frmyginfo.msgList.TextMatrix(frmyginfo.msgList.Row, 1))
sqlDelyg = "delete from 员工表 where 员工编号='" & Trim(frmyginfo.msgList.TextMatrix(frmyginfo.msgList.Row, 1)) & "'"
ExeSQL (sqlDelyg) '删除旧记录
sqlyg = "select * from 员工表 where 员工编号='" & Trim(Text(0).Text) & "'"
Set rsyg = ExeSQL(sqlyg)
If Not rsyg.EOF Then
MsgBox "已经存在编号为" & Trim(Text(0).Text) & "的员工记录,请重输!", vbYesNo, "系统提示"
rsyg.Close
Set rsyg = Nothing
Exit Sub
End If
sqlyg = "insert into 员工表(员工编号,姓名,性别,电话,地址,备注) values('"
sqlyg = sqlyg & Trim(Text(0).Text) & "','" & Trim(Text(1).Text) & "','" & Trim(Combo1.Text) & "','"
sqlyg = sqlyg & Trim(Text(2).Text) & "','" & Trim(Text(3).Text)
If Text(4).Text <> "" Then
sqlyg = sqlyg & "','" & Trim(Text(4).Text) & "')"
Else
sqlyg = sqlyg & "','" & "null" & "')"
End If
'***********更新销售表中编号***********
If Trim(Text(0).Text) <> oldYGid Then
sqlUpData = "update 销售表 set 员工编号='" & Trim(Text(0).Text) & "' where 员工编号='" & oldYGid & "'"
ExeSQL (sqlUpData)
End If
'*****************模块结束******************
ygEdit = 0
End If
'////构建完成
ExeSQL (sqlyg)
MsgBox "输入成功,请返回", vbInformation, "系统提示"
Call Command1_Click
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Form_Unload(Cancel As Integer)
If ygEdit = 1 Then
ygEdit = 0
End If
frmyginfo.ShowTitle
frmyginfo.showdata
Set frmyg = Nothing
End Sub
Public Sub showdata(txtsql As String)
On Error GoTo errorhandle
Dim rsshow As ADODB.Recordset
Dim i As Integer
If txtsql = "" Then
txtsql = "select * from 员工表"
End If
Set rsshow = ExeSQL(txtsql)
For i = 0 To 1
Text(i) = rsshow.Fields(i)
Next
Combo1.Text = rsshow.Fields(2)
For i = 2 To 4
Text(i) = rsshow.Fields(i + 1)
Next
rsshow.Close
Set rsshow = Nothing
Exit Sub
errorhandle:
If Err.Number = 91 Then
Else
MsgBox Err.Number & " " & Err.Description
Resume Next
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -